tc39-proposal-pattern-matching#6761
Conversation
define AST in types.js add a parsing plugin add basic test and fix a parsing bug
new AST of clause fix "else" parsing bug add a test case
fix a bug about string literal add test of match function call
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/7391/ |
|
Thanks for the PR! Issue for babel is at babel/proposals#6 Just FYI @krzkaczor also had started a PR at babel/babylon#635 before we moved babylon back into this repo |
|
@hzoo Oh, I'll take a look at it, I'm sure some code and tests can be reused. |
|
Btw can ast test changes in https://deploy-preview-1421--babel.netlify.com/repl/build/5694/, from babel/website#1421 ah nvm need to make a syntax plugin and add it to stage-0 to test |
.vscode/settings.json
Outdated
| @@ -0,0 +1,3 @@ | |||
| { | |||
There was a problem hiding this comment.
can you commit these config files locally?
remove vscode setting
994c02c to
5802d25
Compare
|
@hzoo got it. |
380cca0 to
e7a325d
Compare
|
@titouancreach yes we will, we are currently busy with the Babel 7 release sorry |
c7d905b to
aea4697
Compare
# Conflicts: # packages/babel-preset-stage-0/package.json # packages/babel-preset-stage-0/src/index.js
|
Please merge this!! Excited to try it out :-) |
| ID: id, | ||
| }); | ||
| } else { | ||
| return template.expression(`(PATTERN[Symbol.match] && |
There was a problem hiding this comment.
The proposal refers to Symbol.matches, not Symbol.match
|
@babakness It's coming soon! I am working on it. |
|
|
||
| switch (pattern.type) { | ||
| case "NumericLiteral": | ||
| case "BigIntLiteral": |
There was a problem hiding this comment.
Since BigInt is not implemented in Babel, I think we should already include it here. It sounds like extra maintenance if it change.
Also it's not testable?
We'll need to create a issue to track that tho.
There was a problem hiding this comment.
So should we keep it?
There was a problem hiding this comment.
I would suggest to remove it, but let's wait for more thoughts on this.
| BODY | ||
| }()`)({ | ||
| BODY: bodyExpr, | ||
| }), |
There was a problem hiding this comment.
I like templates but this one could be clearer using t.* builders IMO
| }, | ||
| [1, 2, 3, 4]: 3, | ||
| [1, 2, 3, 4, 5]: 4 | ||
| }, 666); |
There was a problem hiding this comment.
Why is this feature called stupid-fixture-nesting-folder? That isn't stupid?
There was a problem hiding this comment.
Oh! I just copy the folder from another plugin, I'll remove it. Of cause it isn't stupid.
| 2: "3" | ||
| } | ||
| } catch (e) { | ||
| assert.equal(e.toString(), "Error: No patterns are matched"); |
There was a problem hiding this comment.
There was a problem hiding this comment.
@zkat: [...] the new spec throws a MatchError when no clauses were able to match [...]
|
There are still two issues here:
This PR lasted four months. 😂😂😂 |
I didn't finish my last review, sorry. And sorry if that takes so long, thanks! |
|
nudge: this spec looks pretty different now. See https://github.com/tc39/proposal-pattern-matching |
|
Thanks for the update @zkat, we can see the changes in the PR here tc39/proposal-pattern-matching#65. Sorry for the delai @vincentdchan, TC39 was missing a champion on this proposal and @zkat took over championing now (thanks 😄 ) |
|
@vincentdchan sounds good to me, thanks for your work on this! |
|
I added |
|
Btw @vincentdchan we could close this PR and open a new one if you want to avoid the old comments here, might be easier to follow? |
|
Closed! Move to #7633 |
matchand match expression.stage-0preset before you code.Example:
Progress: