Piotr Caban : jscript: Fix handling of numbers starting with decimal separator.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Apr 28 11:01:51 CDT 2016
Module: wine
Branch: master
Commit: 756c604d9a2d656afd972929c7d9d3cc99c611ca
URL: http://source.winehq.org/git/wine.git/?a=commit;h=756c604d9a2d656afd972929c7d9d3cc99c611ca
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Apr 28 11:12:35 2016 +0200
jscript: Fix handling of numbers starting with decimal separator.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/jscript/lex.c | 3 ++-
dlls/jscript/tests/lang.js | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c
index 65b16a6..3523958 100644
--- a/dlls/jscript/lex.c
+++ b/dlls/jscript/lex.c
@@ -603,7 +603,7 @@ static int next_token(parser_ctx_t *ctx, void *lval)
return '}';
case '.':
- if(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) {
+ if(ctx->ptr+1 < ctx->end && isdigitW(ctx->ptr[1])) {
double n;
HRESULT hres;
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
@@ -614,6 +614,7 @@ static int next_token(parser_ctx_t *ctx, void *lval)
*(literal_t**)lval = new_double_literal(ctx, n);
return tNumericLiteral;
}
+ ctx->ptr++;
return '.';
case '<':
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index ae8e408..95655ab 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -407,6 +407,10 @@ tmp = 2.5*3.5;
ok(tmp > 8.749999 && tmp < 8.750001, "2.5*3.5 !== 8.75");
ok(getVT(tmp) === "VT_R8", "getVT(2.5*3.5) !== VT_R8");
+tmp = 2*.5;
+ok(tmp === 1, "2*.5 !== 1");
+ok(getVT(tmp) == "VT_I4", "getVT(2*.5) !== VT_I4");
+
tmp = 4/2;
ok(tmp === 2, "4/2 !== 2");
ok(getVT(tmp) === "VT_I4", "getVT(4/2) !== VT_I4");
More information about the wine-cvs
mailing list