mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
invalid destructuring assignments like {0} = x now causes syntax error
This commit is contained in:
@@ -899,7 +899,7 @@
|
||||
return If.unfoldSoak(o, this, 'variable');
|
||||
};
|
||||
Assign.prototype.compileNode = function(o) {
|
||||
var _ref2, isValue, match, name, val;
|
||||
var _ref2, assignee, isValue, match, name, val;
|
||||
if (isValue = this.variable instanceof Value) {
|
||||
if (this.variable.isArray() || this.variable.isObject()) {
|
||||
return this.compilePatternMatch(o);
|
||||
@@ -917,6 +917,9 @@
|
||||
if (this.context === 'object') {
|
||||
return "" + name + ": " + val;
|
||||
}
|
||||
if (!(this.variable.isComplex() || IDENTIFIER.test(assignee = this.variable.unwrap().value))) {
|
||||
throw SyntaxError("" + assignee + " cannot be assigned.");
|
||||
}
|
||||
if (!(isValue && (this.variable.hasProperties() || this.variable.namespaced))) {
|
||||
o.scope.find(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user