@@ -2122,8 +2122,9 @@ exports.Assign = class Assign extends Base
2122
2122
@variable .base .lhs = yes
2123
2123
return @ compileDestructuring o unless @variable .isAssignable ()
2124
2124
# Object destructuring. Can be removed once ES proposal hits Stage 4.
2125
- return @ compileObjectDestruct (o) if @variable .isObject () and @variable .contains (node) ->
2125
+ objDestructAnswer = @ compileObjectDestruct (o) if @variable .isObject () and @variable .contains (node) ->
2126
2126
node instanceof Obj and node .hasSplat ()
2127
+ return objDestructAnswer if objDestructAnswer
2127
2128
2128
2129
return @ compileSplice o if @variable .isSplice ()
2129
2130
return @ compileConditional o if @context in [' ||=' , ' &&=' , ' ?=' ]
@@ -2224,8 +2225,12 @@ exports.Assign = class Assign extends Base
2224
2225
if prop instanceof Assign
2225
2226
# prop is `k: expr`, we need to check `expr` for nested splats
2226
2227
if prop .value .isObject ? ()
2227
- # prop is `k: {...}`
2228
- nestedProperties = prop .value .base .properties
2228
+ if prop .operatorToken .unwrap ().value is ' :'
2229
+ # prop is `k: {...}`
2230
+ nestedProperties = prop .value .base .properties
2231
+ if prop .operatorToken .unwrap ().value is ' ='
2232
+ # prop is `k = {...} `
2233
+ continue
2229
2234
else if prop .value instanceof Assign and prop .value .variable .isObject ()
2230
2235
# prop is `k: {...} = default`
2231
2236
nestedProperties = prop .value .variable .base .properties
@@ -2254,8 +2259,10 @@ exports.Assign = class Assign extends Base
2254
2259
2255
2260
# Find all rest elements.
2256
2261
restElements = traverseRest @variable .base .properties , valueRef
2262
+ return false unless restElements and restElements .length > 0
2257
2263
2258
2264
result = new Block [@ ]
2265
+
2259
2266
for restElement in restElements
2260
2267
value = new Call new Value (new Literal utility ' objectWithoutKeys' , o), [restElement .source , restElement .excludeProps ]
2261
2268
result .push new Assign restElement .name , value
0 commit comments