mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Throwing an error when pattern matching has a non-identifier on the left-hand side.
This commit is contained in:
@@ -943,6 +943,9 @@
|
||||
obj = _c[0];
|
||||
idx = _c[1];
|
||||
}
|
||||
if (!(obj instanceof ValueNode || obj instanceof SplatNode)) {
|
||||
throw new Error('pattern matching must use only identifiers on the left-hand side.');
|
||||
}
|
||||
is_string = idx.value && idx.value.match(IS_STRING);
|
||||
access_class = is_string || this.variable.is_array() ? IndexNode : AccessorNode;
|
||||
if (obj instanceof SplatNode && !splat) {
|
||||
|
||||
Reference in New Issue
Block a user