Merge pull request #2925 from marchaefner/master

Fix error reporting for invalid object key.
This commit is contained in:
Michael Ficarra
2013-04-15 13:07:16 -07:00
2 changed files with 2 additions and 2 deletions

View File

@@ -1228,7 +1228,7 @@
join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n';
indent = prop instanceof Comment ? '' : idt;
if (prop instanceof Assign && prop.variable instanceof Value && prop.variable.hasProperties()) {
throw new SyntaxError('Invalid object key');
prop.variable.error('Invalid object key');
}
if (prop instanceof Value && prop["this"]) {
prop = new Assign(prop.properties[0].name, prop, 'object');

View File

@@ -897,7 +897,7 @@ exports.Obj = class Obj extends Base
',\n'
indent = if prop instanceof Comment then '' else idt
if prop instanceof Assign and prop.variable instanceof Value and prop.variable.hasProperties()
throw new SyntaxError 'Invalid object key'
prop.variable.error 'Invalid object key'
if prop instanceof Value and prop.this
prop = new Assign prop.properties[0].name, prop, 'object'
if prop not instanceof Comment