jscript: Fix handling of numbers starting with decimal separator.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
148075b183
commit
756c604d9a
|
@ -603,7 +603,7 @@ static int next_token(parser_ctx_t *ctx, void *lval)
|
||||||
return '}';
|
return '}';
|
||||||
|
|
||||||
case '.':
|
case '.':
|
||||||
if(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) {
|
if(ctx->ptr+1 < ctx->end && isdigitW(ctx->ptr[1])) {
|
||||||
double n;
|
double n;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
|
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);
|
*(literal_t**)lval = new_double_literal(ctx, n);
|
||||||
return tNumericLiteral;
|
return tNumericLiteral;
|
||||||
}
|
}
|
||||||
|
ctx->ptr++;
|
||||||
return '.';
|
return '.';
|
||||||
|
|
||||||
case '<':
|
case '<':
|
||||||
|
|
|
@ -407,6 +407,10 @@ tmp = 2.5*3.5;
|
||||||
ok(tmp > 8.749999 && tmp < 8.750001, "2.5*3.5 !== 8.75");
|
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");
|
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;
|
tmp = 4/2;
|
||||||
ok(tmp === 2, "4/2 !== 2");
|
ok(tmp === 2, "4/2 !== 2");
|
||||||
ok(getVT(tmp) === "VT_I4", "getVT(4/2) !== VT_I4");
|
ok(getVT(tmp) === "VT_I4", "getVT(4/2) !== VT_I4");
|
||||||
|
|
Loading…
Reference in New Issue