mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
[x] = [y] = [1] works again
This commit is contained in:
@@ -991,7 +991,7 @@
|
|||||||
return value.compile(o);
|
return value.compile(o);
|
||||||
}
|
}
|
||||||
isObject = this.variable.isObject();
|
isObject = this.variable.isObject();
|
||||||
if (olength === 1 && !((obj = objects[0]) instanceof SplatNode)) {
|
if (o.top && olength === 1 && !((obj = objects[0]) instanceof SplatNode)) {
|
||||||
if (obj instanceof AssignNode) {
|
if (obj instanceof AssignNode) {
|
||||||
_ref2 = obj, idx = _ref2.variable.base, obj = _ref2.value;
|
_ref2 = obj, idx = _ref2.variable.base, obj = _ref2.value;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -877,7 +877,7 @@ exports.AssignNode = class AssignNode extends BaseNode
|
|||||||
{objects} = @variable.base
|
{objects} = @variable.base
|
||||||
return value.compile o unless olength = objects.length
|
return value.compile o unless olength = objects.length
|
||||||
isObject = @variable.isObject()
|
isObject = @variable.isObject()
|
||||||
if olength is 1 and (obj = objects[0]) not instanceof SplatNode
|
if o.top and olength is 1 and (obj = objects[0]) not instanceof SplatNode
|
||||||
# Unroll simplest cases: `{v} = x` -> `v = x.v`
|
# Unroll simplest cases: `{v} = x` -> `v = x.v`
|
||||||
if obj instanceof AssignNode
|
if obj instanceof AssignNode
|
||||||
{variable: {base: idx}, value: obj} = obj
|
{variable: {base: idx}, value: obj} = obj
|
||||||
|
|||||||
@@ -139,3 +139,6 @@ if func func
|
|||||||
{a} = obj
|
{a} = obj
|
||||||
|
|
||||||
ok a is 101
|
ok a is 101
|
||||||
|
|
||||||
|
[x] = {0: y} = {'0': z} = [Math.random()]
|
||||||
|
ok x is y is z, 'destructuring in multiple'
|
||||||
|
|||||||
Reference in New Issue
Block a user