Merge pull request #2299 from geraldalewis/2213-no-method-is-array

Wraps up #2211 -- addresses invocations within destructured params
This commit is contained in:
Michael Ficarra
2012-05-12 17:30:48 -07:00
3 changed files with 30 additions and 15 deletions

View File

@@ -1936,15 +1936,19 @@
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
obj = _ref2[_i];
if (obj instanceof Assign) {
names.push(obj.value.base.value);
names.push(obj.value.unwrap().value);
} else if (obj instanceof Splat) {
names.push(obj.name.unwrap().value);
} else if (obj.isArray() || obj.isObject()) {
names.push.apply(names, this.names(obj.base));
} else if (obj["this"]) {
names.push.apply(names, atParam(obj));
} else if (obj instanceof Value) {
if (obj.isArray() || obj.isObject()) {
names.push.apply(names, this.names(obj.base));
} else if (obj["this"]) {
names.push.apply(names, atParam(obj));
} else {
names.push(obj.base.value);
}
} else {
names.push(obj.base.value);
throw SyntaxError("illegal parameter " + (obj.compile()));
}
}
return names;