-
-
Notifications
You must be signed in to change notification settings - Fork 258
[7.0] Change RestProperty/SpreadProperty to RestElement/SpreadElement #384
Conversation
c50aab2
to
96560c3
Compare
96560c3
to
9cdf422
Compare
Codecov Report
@@ Coverage Diff @@
## 7.0 #384 +/- ##
=========================================
+ Coverage 97.88% 97.9% +0.02%
=========================================
Files 20 20
Lines 3444 3443 -1
Branches 910 910
=========================================
Hits 3371 3371
Misses 30 30
+ Partials 43 42 -1
Continue to review full report at Codecov.
|
@@ -34,8 +34,8 @@ pp.toAssignable = function (node, isBinding, contextDescription) { | |||
this.toAssignable(node.value, isBinding, contextDescription); | |||
break; | |||
|
|||
case "SpreadProperty": | |||
node.type = "RestProperty"; | |||
case "SpreadElement": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SpreadElement should only be converted to RestElement if isBinding === true and otherwise fail.
Previously we were not converting SpreadElement
at all, but now we need to in some cases (the cases that were previously SpreadProperty)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have time to finish this up, go ahead 👍
need to fix a failing test
estree-throws › es2015/uncategorised/288
/Users/hzhu/dev/babylon/test/utils/runFixtureTests.js:92
91: if (opts.throws) {
92: throw new Error("Expected error message: " + opts.throws + ". But parsing succeeded.");
93: } else {
Error: /Users/hzhu/dev/babylon/test/fixtures/es2015/uncategorised/288/actual.js: Expected error message: Invalid left-hand side in assignment expression (1:1). But parsing succeeded.
Odd that
[...a, b] = c
is parsing as a SpreadElement when it should be a RestElement?