Jacek Caban : jscript: Fixed array literal length calculation.

Alexandre Julliard julliard at winehq.org
Mon Sep 22 07:04:07 CDT 2008


Module: wine
Branch: master
Commit: 45cd5bc4a22926fe3a896992ae8606e4e8bc8e8d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=45cd5bc4a22926fe3a896992ae8606e4e8bc8e8d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Sep 21 15:38:52 2008 +0200

jscript: Fixed array literal length calculation.

---

 dlls/jscript/parser.y      |    2 +-
 dlls/jscript/tests/lang.js |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y
index a6cb5eb..c7c6fb4 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -725,7 +725,7 @@ ArrayLiteral
         : '[' Elision_opt ']'   { $$ = new_array_literal_expression(ctx, NULL, $2); }
         | '[' ElementList ']'   { $$ = new_array_literal_expression(ctx, $2, 0); }
         | '[' ElementList ',' Elision_opt ']'
-                                { $$ = new_array_literal_expression(ctx, $2, $4); }
+                                { $$ = new_array_literal_expression(ctx, $2, $4+1); }
 
 /* ECMA-262 3rd Edition    11.1.4 */
 ElementList
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index 484d192..5f13b05 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -592,6 +592,8 @@ ok(tmp["3"] === 2, "tmp[3] !== 2");
 ok(tmp["6"] === true, "tmp[6] !== true");
 ok(tmp[2] === 1, "tmp[2] !== 1");
 
+ok([1,].length === 2, "[1,].length !== 2");
+
 tmp = 0;
 while(tmp < 4) {
     ok(tmp < 4, "tmp >= 4");




More information about the wine-cvs mailing list