jscript: Fixed list literal length calculation.
This commit is contained in:
parent
7a8cfdee6d
commit
4783dd1e54
|
@ -738,7 +738,8 @@ PrimaryExpression
|
||||||
|
|
||||||
/* ECMA-262 3rd Edition 11.1.4 */
|
/* ECMA-262 3rd Edition 11.1.4 */
|
||||||
ArrayLiteral
|
ArrayLiteral
|
||||||
: '[' Elision_opt ']' { $$ = new_array_literal_expression(ctx, NULL, $2); }
|
: '[' ']' { $$ = new_array_literal_expression(ctx, NULL, 0); }
|
||||||
|
| '[' Elision_opt ']' { $$ = new_array_literal_expression(ctx, NULL, $2+1); }
|
||||||
| '[' ElementList ']' { $$ = new_array_literal_expression(ctx, $2, 0); }
|
| '[' ElementList ']' { $$ = new_array_literal_expression(ctx, $2, 0); }
|
||||||
| '[' ElementList ',' Elision_opt ']'
|
| '[' ElementList ',' Elision_opt ']'
|
||||||
{ $$ = new_array_literal_expression(ctx, $2, $4+1); }
|
{ $$ = new_array_literal_expression(ctx, $2, $4+1); }
|
||||||
|
|
|
@ -615,6 +615,9 @@ ok(tmp["6"] === true, "tmp[6] !== true");
|
||||||
ok(tmp[2] === 1, "tmp[2] !== 1");
|
ok(tmp[2] === 1, "tmp[2] !== 1");
|
||||||
|
|
||||||
ok([1,].length === 2, "[1,].length !== 2");
|
ok([1,].length === 2, "[1,].length !== 2");
|
||||||
|
ok([,,].length === 3, "[,,].length !== 3");
|
||||||
|
ok([,].length === 2, "[].length != 2");
|
||||||
|
ok([].length === 0, "[].length != 0");
|
||||||
|
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
while(tmp < 4) {
|
while(tmp < 4) {
|
||||||
|
|
Loading…
Reference in New Issue