Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4cfab077
Commit
4cfab077
authored
Jun 20, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Always store numeric literals as double.
parent
0e55fb68
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
67 deletions
+18
-67
compile.c
dlls/jscript/compile.c
+0
-5
engine.c
dlls/jscript/engine.c
+1
-4
engine.h
dlls/jscript/engine.h
+0
-2
lex.c
dlls/jscript/lex.c
+17
-56
No files found.
dlls/jscript/compile.c
View file @
4cfab077
...
...
@@ -712,8 +712,6 @@ static HRESULT compile_literal(compiler_ctx_t *ctx, literal_t *literal)
return
push_instr_int
(
ctx
,
OP_bool
,
literal
->
u
.
bval
);
case
LT_DOUBLE
:
return
push_instr_double
(
ctx
,
OP_double
,
literal
->
u
.
dval
);
case
LT_INT
:
return
push_instr_int
(
ctx
,
OP_int
,
literal
->
u
.
lval
);
case
LT_NULL
:
return
push_instr
(
ctx
,
OP_null
)
?
S_OK
:
E_OUTOFMEMORY
;
case
LT_STRING
:
...
...
@@ -748,9 +746,6 @@ static HRESULT literal_as_bstr(compiler_ctx_t *ctx, literal_t *literal, BSTR *st
case
LT_STRING
:
*
str
=
compiler_alloc_bstr
(
ctx
,
literal
->
u
.
wstr
);
break
;
case
LT_INT
:
*
str
=
int_to_bstr
(
literal
->
u
.
lval
);
break
;
case
LT_DOUBLE
:
return
double_to_bstr
(
literal
->
u
.
dval
,
str
);
default:
...
...
dlls/jscript/engine.c
View file @
4cfab077
...
...
@@ -1185,13 +1185,10 @@ static HRESULT interp_int(exec_ctx_t *ctx)
static
HRESULT
interp_double
(
exec_ctx_t
*
ctx
)
{
const
double
arg
=
get_op_double
(
ctx
);
VARIANT
v
;
TRACE
(
"%lf
\n
"
,
arg
);
V_VT
(
&
v
)
=
VT_R8
;
V_R8
(
&
v
)
=
arg
;
return
stack_push
(
ctx
,
&
v
);
return
stack_push_number
(
ctx
,
arg
);
}
/* ECMA-262 3rd Edition 7.8.4 */
...
...
dlls/jscript/engine.h
View file @
4cfab077
...
...
@@ -248,7 +248,6 @@ HRESULT exec_source(exec_ctx_t*,bytecode_t*,function_code_t*,BOOL,jsexcept_t*,VA
HRESULT
create_source_function
(
script_ctx_t
*
,
bytecode_t
*
,
function_code_t
*
,
scope_chain_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
typedef
enum
{
LT_INT
,
LT_DOUBLE
,
LT_STRING
,
LT_BOOL
,
...
...
@@ -259,7 +258,6 @@ typedef enum {
typedef
struct
{
literal_type_t
type
;
union
{
LONG
lval
;
double
dval
;
const
WCHAR
*
wstr
;
VARIANT_BOOL
bval
;
...
...
dlls/jscript/lex.c
View file @
4cfab077
...
...
@@ -376,16 +376,6 @@ static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret, WCHAR endc
return
tStringLiteral
;
}
static
literal_t
*
new_int_literal
(
parser_ctx_t
*
ctx
,
LONG
l
)
{
literal_t
*
ret
=
parser_alloc
(
ctx
,
sizeof
(
literal_t
));
ret
->
type
=
LT_INT
;
ret
->
u
.
lval
=
l
;
return
ret
;
}
static
literal_t
*
new_double_literal
(
parser_ctx_t
*
ctx
,
DOUBLE
d
)
{
literal_t
*
ret
=
parser_alloc
(
ctx
,
sizeof
(
literal_t
));
...
...
@@ -410,12 +400,6 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
LONGLONG
d
,
hlp
;
int
exp
=
0
;
if
(
ctx
->
ptr
==
ctx
->
end
||
(
!
isdigitW
(
*
ctx
->
ptr
)
&&
*
ctx
->
ptr
!=
'.'
&&
*
ctx
->
ptr
!=
'e'
&&
*
ctx
->
ptr
!=
'E'
))
{
ERR
(
"Illegal character
\n
"
);
return
0
;
}
d
=
int_part
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
hlp
=
d
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
...
...
@@ -431,18 +415,20 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
ctx
->
ptr
++
;
}
if
(
*
ctx
->
ptr
==
'.'
)
ctx
->
ptr
++
;
if
(
*
ctx
->
ptr
==
'.'
)
{
ctx
->
ptr
++
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
hlp
=
d
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
if
(
d
>
LONGLONG_MAX
/
10
||
hlp
<
0
)
break
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
hlp
=
d
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
if
(
d
>
LONGLONG_MAX
/
10
||
hlp
<
0
)
break
;
d
=
hlp
;
exp
--
;
d
=
hlp
;
exp
--
;
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
ctx
->
ptr
++
;
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
ctx
->
ptr
++
;
if
(
ctx
->
ptr
<
ctx
->
end
&&
(
*
ctx
->
ptr
==
'e'
||
*
ctx
->
ptr
==
'E'
))
{
int
sign
=
1
,
e
=
0
;
...
...
@@ -485,11 +471,6 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
LONG
l
,
d
;
l
=
*
ctx
->
ptr
++
-
'0'
;
if
(
ctx
->
ptr
==
ctx
->
end
)
{
*
literal
=
new_int_literal
(
ctx
,
l
);
return
tNumericLiteral
;
}
if
(
!
l
)
{
if
(
*
ctx
->
ptr
==
'x'
||
*
ctx
->
ptr
==
'X'
)
{
if
(
++
ctx
->
ptr
==
ctx
->
end
)
{
...
...
@@ -507,42 +488,22 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
return
lex_error
(
ctx
,
E_FAIL
);
}
*
literal
=
new_
int
_literal
(
ctx
,
l
);
*
literal
=
new_
double
_literal
(
ctx
,
l
);
return
tNumericLiteral
;
}
if
(
is
digitW
(
*
ctx
->
ptr
)
||
is
_identifier_char
(
*
ctx
->
ptr
))
{
if
(
is_identifier_char
(
*
ctx
->
ptr
))
{
WARN
(
"wrong char after zero
\n
"
);
return
lex_error
(
ctx
,
E_FAIL
);
}
*
literal
=
new_int_literal
(
ctx
,
0
);
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
d
=
l
*
10
+
*
(
ctx
->
ptr
)
-
'0'
;
/* Check for integer overflow */
if
(
l
>
INT_MAX
/
10
||
d
<
0
)
return
parse_double_literal
(
ctx
,
l
,
literal
);
l
=
d
;
ctx
->
ptr
++
;
}
if
(
ctx
->
ptr
<
ctx
->
end
)
{
if
(
*
ctx
->
ptr
==
'.'
||
*
ctx
->
ptr
==
'e'
||
*
ctx
->
ptr
==
'E'
)
return
parse_double_literal
(
ctx
,
l
,
literal
);
if
(
is_identifier_char
(
*
ctx
->
ptr
))
{
WARN
(
"unexpected identifier char
\n
"
);
return
lex_error
(
ctx
,
E_FAIL
);
if
(
isdigitW
(
*
ctx
->
ptr
))
{
FIXME
(
"octal literals not implemented
\n
"
);
return
lex_error
(
ctx
,
E_NOTIMPL
);
}
}
*
literal
=
new_int_literal
(
ctx
,
l
);
return
tNumericLiteral
;
return
parse_double_literal
(
ctx
,
l
,
literal
);
}
static
int
next_token
(
parser_ctx_t
*
ctx
,
void
*
lval
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment