Jacek Caban : jscript: Fixed list literal length calculation.
Alexandre Julliard
julliard at winehq.org
Wed Oct 8 08:32:41 CDT 2008
Module: wine
Branch: master
Commit: 4783dd1e543967997f54bec0250c88a69661a2f6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4783dd1e543967997f54bec0250c88a69661a2f6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Oct 7 12:01:06 2008 -0500
jscript: Fixed list literal length calculation.
---
dlls/jscript/parser.y | 3 ++-
dlls/jscript/tests/lang.js | 3 +++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y
index 2123e9c..8f01028 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -738,7 +738,8 @@ PrimaryExpression
/* ECMA-262 3rd Edition 11.1.4 */
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 ',' Elision_opt ']'
{ $$ = new_array_literal_expression(ctx, $2, $4+1); }
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index c9d9455..82e865f 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -615,6 +615,9 @@ ok(tmp["6"] === true, "tmp[6] !== true");
ok(tmp[2] === 1, "tmp[2] !== 1");
ok([1,].length === 2, "[1,].length !== 2");
+ok([,,].length === 3, "[,,].length !== 3");
+ok([,].length === 2, "[].length != 2");
+ok([].length === 0, "[].length != 0");
tmp = 0;
while(tmp < 4) {
More information about the wine-cvs
mailing list