Issue #1024.
This commit is contained in:
parent
45058dfa79
commit
44355f8eef
|
@ -1126,7 +1126,12 @@
|
|||
value = this.value;
|
||||
objects = this.variable.base.objects;
|
||||
if (!(olen = objects.length)) {
|
||||
return value.compile(o);
|
||||
code = value.compile(o);
|
||||
if (o.level >= LEVEL_OP) {
|
||||
return "(" + code + ")";
|
||||
} else {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
isObject = this.variable.isObject();
|
||||
if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) {
|
||||
|
|
|
@ -899,7 +899,9 @@ exports.Assign = class Assign extends Base
|
|||
top = o.level is LEVEL_TOP
|
||||
{value} = this
|
||||
{objects} = @variable.base
|
||||
return value.compile o unless olen = objects.length
|
||||
unless olen = objects.length
|
||||
code = value.compile o
|
||||
return if o.level >= LEVEL_OP then "(#{code})" else code
|
||||
isObject = @variable.isObject()
|
||||
if top and olen is 1 and (obj = objects[0]) not instanceof Splat
|
||||
# Unroll simplest cases: `{v} = x` -> `v = x.v`
|
||||
|
|
|
@ -247,6 +247,9 @@ test "destructuring assignment with context (@) properties", ->
|
|||
eq d, obj.d
|
||||
eq e, obj.e
|
||||
|
||||
test "#1024", ->
|
||||
eq 2 * [] = 3 + 5, 16
|
||||
|
||||
|
||||
#### Existential Assignment
|
||||
|
||||
|
|
Loading…
Reference in New Issue