Commit 4cabe361 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Allow trailing comma in object literals.

parent adcb2162
...@@ -778,6 +778,14 @@ ObjectLiteral ...@@ -778,6 +778,14 @@ ObjectLiteral
: '{' '}' { $$ = new_prop_and_value_expression(ctx, NULL); } : '{' '}' { $$ = new_prop_and_value_expression(ctx, NULL); }
| '{' PropertyNameAndValueList '}' | '{' PropertyNameAndValueList '}'
{ $$ = new_prop_and_value_expression(ctx, $2); } { $$ = new_prop_and_value_expression(ctx, $2); }
| '{' PropertyNameAndValueList ',' '}'
{
if(ctx->script->version < 2) {
WARN("Trailing comma in object literal is illegal in legacy mode.\n");
YYABORT;
}
$$ = new_prop_and_value_expression(ctx, $2);
}
/* ECMA-262 3rd Edition 11.1.5 */ /* ECMA-262 3rd Edition 11.1.5 */
PropertyNameAndValueList PropertyNameAndValueList
......
...@@ -480,6 +480,20 @@ ok(obj3.prop1 === 1, "obj3.prop1 is not 1"); ...@@ -480,6 +480,20 @@ ok(obj3.prop1 === 1, "obj3.prop1 is not 1");
ok(obj3.prop2 === "boolean", "obj3.prop2 is not \"boolean\""); ok(obj3.prop2 === "boolean", "obj3.prop2 is not \"boolean\"");
ok(obj3.constructor === Object, "unexpected obj3.constructor"); ok(obj3.constructor === Object, "unexpected obj3.constructor");
if(invokeVersion >= 2) {
eval("tmp = {prop: 'value',}");
ok(tmp.prop === "value", "tmp.prop = " + tmp.prop);
eval("tmp = {prop: 'value',second:2,}");
ok(tmp.prop === "value", "tmp.prop = " + tmp.prop);
}else {
try {
eval("tmp = {prop: 'value',}");
}catch(e) {
tmp = true;
}
ok(tmp === true, "exception not fired");
}
{ {
var blockVar = 1; var blockVar = 1;
blockVar = 2; blockVar = 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment