mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
fixed issue with nested properties
This commit is contained in:
@@ -2233,7 +2233,7 @@ exports.Assign = class Assign extends Base
|
||||
nestedSource = new Value source.base, source.properties.concat [new Access getPropKey prop]
|
||||
nestedSource = new Value new Op '?', nestedSource, nestedSourceDefault if nestedSourceDefault
|
||||
else
|
||||
nestedSource = source
|
||||
nestedSource = new Value source, [new Access getPropKey prop]
|
||||
restElements.push traverseRest(nestedProperties, nestedSource)...
|
||||
else if prop instanceof Splat
|
||||
prop.error "multiple rest elements are disallowed in object destructuring" if restIndex?
|
||||
@@ -2251,15 +2251,7 @@ exports.Assign = class Assign extends Base
|
||||
restElements
|
||||
|
||||
# Cache the value for reuse with rest elements.
|
||||
# `Obj` should be always cached.
|
||||
# Examples:
|
||||
# {a, r...} = {a:1, b:2, c:3}
|
||||
# {a, r...} = {a:1, obj...}
|
||||
shouldCache = (value) ->
|
||||
return yes if value.base instanceof Obj
|
||||
value.shouldCache()
|
||||
|
||||
[@value, valueRef] = @value.cache o, false, shouldCache
|
||||
[@value, valueRef] = @value.cache o
|
||||
|
||||
# Find all rest elements.
|
||||
restElements = traverseRest @variable.base.properties, valueRef
|
||||
|
||||
Reference in New Issue
Block a user