mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
fixes #1591: splatted expressions in destructuring assignment must be assignable
This commit is contained in:
parent
c0e0ede09f
commit
e17b67e6f2
2 changed files with 5 additions and 0 deletions
|
@ -1153,6 +1153,9 @@
|
|||
}
|
||||
}
|
||||
if (!splat && obj instanceof Splat) {
|
||||
if (!obj.name.unwrapAll().isAssignable()) {
|
||||
throw SyntaxError("\"" + (obj.name.compile(o)) + "\" cannot be assigned.");
|
||||
}
|
||||
name = obj.name.unwrap().value;
|
||||
val = "" + olen + " <= " + vvar + ".length ? " + (utility('slice')) + ".call(" + vvar + ", " + i;
|
||||
if (rest = olen - i - 1) {
|
||||
|
|
|
@ -1005,6 +1005,8 @@ exports.Assign = class Assign extends Base
|
|||
else
|
||||
idx = if obj.this then obj.properties[0].name else obj
|
||||
if not splat and obj instanceof Splat
|
||||
unless obj.name.unwrapAll().isAssignable()
|
||||
throw SyntaxError "\"#{ obj.name.compile(o) }\" cannot be assigned."
|
||||
name = obj.name.unwrap().value
|
||||
val = "#{olen} <= #{vvar}.length ? #{ utility 'slice' }.call(#{vvar}, #{i}"
|
||||
if rest = olen - i - 1
|
||||
|
|
Loading…
Add table
Reference in a new issue