jscript: Allow trailing comma in object literals.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
adcb216208
commit
4cabe3612f
|
@ -778,6 +778,14 @@ ObjectLiteral
|
|||
: '{' '}' { $$ = new_prop_and_value_expression(ctx, NULL); }
|
||||
| '{' PropertyNameAndValueList '}'
|
||||
{ $$ = 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 */
|
||||
PropertyNameAndValueList
|
||||
|
|
|
@ -480,6 +480,20 @@ ok(obj3.prop1 === 1, "obj3.prop1 is not 1");
|
|||
ok(obj3.prop2 === "boolean", "obj3.prop2 is not \"boolean\"");
|
||||
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;
|
||||
blockVar = 2;
|
||||
|
|
Loading…
Reference in New Issue