This repository was archived by the owner on May 19, 2018. It is now read-only.
Conversation
2 tasks
jridgewell
suggested changes
Sep 28, 2017
src/tokenizer/index.js
Outdated
| if (code === 124) { | ||
| // '|>' | ||
| if (next === 62) { | ||
| this.expectPlugin("pipelineOperator"); |
Member
There was a problem hiding this comment.
Don't we usually expect in the not-tokenizer part?
| @@ -411,9 +411,17 @@ export default class Tokenizer extends LocationParser { | |||
| const next = this.input.charCodeAt(this.state.pos + 1); | |||
| @@ -0,0 +1 @@ | |||
| a |> b | |||
Member
There was a problem hiding this comment.
More examples, especially arrows.
jridgewell
approved these changes
Sep 29, 2017
littledan
reviewed
Sep 30, 2017
| this.prefix = !!conf.prefix; | ||
| this.postfix = !!conf.postfix; | ||
| this.binop = conf.binop || null; | ||
| this.binop = conf.binop === 0 ? 0 : conf.binop || null; |
Member
Author
There was a problem hiding this comment.
Yes, should be easy to add/use here (would be good to find this kind of code on github/codebase and then do a codemod)
| if (node.operator === "|>") { | ||
| this.expectPlugin("pipelineOperator"); | ||
| // Support syntax such as 10 |> x => x + 1 | ||
| this.state.potentialArrowAt = startPos; |
There was a problem hiding this comment.
I don't think the current draft spec has this logic. I couldn't figure out how to put it into the grammar. Right now, x |> y => z would be a syntax error. But it's clearly useful--i'll think more about the spec.
Member
Author
There was a problem hiding this comment.
Good to know tc39/proposal-pipeline-operator#60
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ref babel/proposals#29
Taken from babel/babel#3159 by @gilbert
Spec: https://github.com/tc39/proposal-pipeline-operator/pull/51/files
need more tests
10 |> x => x + 1;a |> b |> c