Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
150b7391
Commit
150b7391
authored
Feb 04, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Add GetSourceLineText implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
26ad9a7b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
12 deletions
+41
-12
compile.c
dlls/jscript/compile.c
+1
-1
engine.c
dlls/jscript/engine.c
+1
-1
engine.h
dlls/jscript/engine.h
+2
-1
error.c
dlls/jscript/error.c
+3
-1
jscript.c
dlls/jscript/jscript.c
+12
-3
parser.y
dlls/jscript/parser.y
+15
-3
run.c
dlls/jscript/tests/run.c
+7
-2
No files found.
dlls/jscript/compile.c
View file @
150b7391
...
...
@@ -2521,7 +2521,7 @@ HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, UINT64 source_conte
if
(
FAILED
(
hres
))
{
if
(
hres
!=
DISP_E_EXCEPTION
)
throw_error
(
ctx
,
hres
,
NULL
);
set_error_location
(
ctx
->
ei
,
compiler
.
code
,
compiler
.
loc
,
IDS_COMPILATION_ERROR
);
set_error_location
(
ctx
->
ei
,
compiler
.
code
,
compiler
.
loc
,
IDS_COMPILATION_ERROR
,
NULL
);
release_bytecode
(
compiler
.
code
);
return
DISP_E_EXCEPTION
;
}
...
...
dlls/jscript/engine.c
View file @
150b7391
...
...
@@ -2779,7 +2779,7 @@ static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres)
frame
=
ctx
->
call_ctx
;
if
(
exception_hres
!=
DISP_E_EXCEPTION
)
throw_error
(
ctx
,
exception_hres
,
NULL
);
set_error_location
(
ei
,
frame
->
bytecode
,
frame
->
bytecode
->
instrs
[
frame
->
ip
].
loc
,
IDS_RUNTIME_ERROR
);
set_error_location
(
ei
,
frame
->
bytecode
,
frame
->
bytecode
->
instrs
[
frame
->
ip
].
loc
,
IDS_RUNTIME_ERROR
,
NULL
);
while
(
!
frame
->
except_frame
)
{
DWORD
flags
;
...
...
dlls/jscript/engine.h
View file @
150b7391
...
...
@@ -229,6 +229,7 @@ struct _jsexcept_t {
jsstr_t
*
source
;
jsstr_t
*
message
;
jsstr_t
*
line
;
bytecode_t
*
code
;
unsigned
loc
;
...
...
@@ -240,7 +241,7 @@ struct _jsexcept_t {
void
enter_script
(
script_ctx_t
*
,
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
leave_script
(
script_ctx_t
*
,
HRESULT
)
DECLSPEC_HIDDEN
;
void
reset_ei
(
jsexcept_t
*
)
DECLSPEC_HIDDEN
;
void
set_error_location
(
jsexcept_t
*
,
bytecode_t
*
,
unsigned
,
unsigned
)
DECLSPEC_HIDDEN
;
void
set_error_location
(
jsexcept_t
*
,
bytecode_t
*
,
unsigned
,
unsigned
,
jsstr_t
*
)
DECLSPEC_HIDDEN
;
typedef
struct
_except_frame_t
except_frame_t
;
struct
_parser_ctx_t
;
...
...
dlls/jscript/error.c
View file @
150b7391
...
...
@@ -420,7 +420,7 @@ HRESULT throw_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
return
DISP_E_EXCEPTION
;
}
void
set_error_location
(
jsexcept_t
*
ei
,
bytecode_t
*
code
,
unsigned
loc
,
unsigned
source_id
)
void
set_error_location
(
jsexcept_t
*
ei
,
bytecode_t
*
code
,
unsigned
loc
,
unsigned
source_id
,
jsstr_t
*
line
)
{
if
(
is_jscript_error
(
ei
->
error
))
{
if
(
!
ei
->
source
)
{
...
...
@@ -438,6 +438,8 @@ void set_error_location(jsexcept_t *ei, bytecode_t *code, unsigned loc, unsigned
ei
->
code
=
bytecode_addref
(
code
);
ei
->
loc
=
loc
;
if
(
line
)
ei
->
line
=
jsstr_addref
(
line
);
}
jsdisp_t
*
create_builtin_error
(
script_ctx_t
*
ctx
)
...
...
dlls/jscript/jscript.c
View file @
150b7391
...
...
@@ -211,12 +211,17 @@ static HRESULT WINAPI JScriptError_GetSourceLineText(IActiveScriptError *iface,
{
JScriptError
*
This
=
impl_from_IActiveScriptError
(
iface
);
FIXM
E
(
"(%p)->(%p)
\n
"
,
This
,
source
);
TRAC
E
(
"(%p)->(%p)
\n
"
,
This
,
source
);
if
(
!
source
)
return
E_POINTER
;
*
source
=
NULL
;
return
E_FAIL
;
if
(
!
This
->
ei
.
line
)
{
*
source
=
NULL
;
return
E_FAIL
;
}
return
jsstr_to_bstr
(
This
->
ei
.
line
,
source
);
}
static
const
IActiveScriptErrorVtbl
JScriptErrorVtbl
=
{
...
...
@@ -248,6 +253,10 @@ void reset_ei(jsexcept_t *ei)
jsstr_release
(
ei
->
message
);
ei
->
message
=
NULL
;
}
if
(
ei
->
line
)
{
jsstr_release
(
ei
->
line
);
ei
->
line
=
NULL
;
}
}
void
enter_script
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
)
...
...
dlls/jscript/parser.y
View file @
150b7391
...
...
@@ -1598,12 +1598,24 @@ HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, byteco
heap_pool_clear(mark);
hres = parser_ctx->hres;
if(FAILED(hres)) {
WARN("parser failed around %s\n",
debugstr_w(parser_ctx->begin+20 > parser_ctx->ptr ? parser_ctx->begin : parser_ctx->ptr-20));
const WCHAR *line_start = code->source + parser_ctx->error_loc, *line_end = line_start;
jsstr_t *line_str;
while(line_start > code->source && line_start[-1] != '\n')
line_start--;
while(*line_end && *line_end != '\n')
line_end++;
line_str = jsstr_alloc_len(line_start, line_end - line_start);
WARN("parser failed around %s in line %s\n",
debugstr_w(parser_ctx->begin+20 > parser_ctx->ptr ? parser_ctx->begin : parser_ctx->ptr-20),
debugstr_jsstr(line_str));
throw_error(ctx, hres, NULL);
set_error_location(ctx->ei, code, parser_ctx->error_loc, IDS_COMPILATION_ERROR);
set_error_location(ctx->ei, code, parser_ctx->error_loc, IDS_COMPILATION_ERROR
, line_str
);
parser_release(parser_ctx);
if(line_str)
jsstr_release(line_str);
return DISP_E_EXCEPTION;
}
...
...
dlls/jscript/tests/run.c
View file @
150b7391
...
...
@@ -2232,6 +2232,13 @@ static void test_error_reports(void)
NULL
,
ERROR_TODO_SCODE
|
ERROR_TODO_DESCRIPTION
},
{
L"f(1
\n
,
\n
2,
\n
,,3
\n
);
\n
"
,
JS_E_SYNTAX
,
3
,
1
,
L"Microsoft JScript compilation error"
,
L"Syntax error"
,
L" ,,3"
},
};
if
(
!
is_lang_english
())
...
...
@@ -2304,9 +2311,7 @@ static void test_error_reports(void)
hres
=
IActiveScriptError_GetSourceLineText
(
script_error
,
&
line_text
);
if
(
tests
[
i
].
line_text
)
{
todo_wine
ok
(
hres
==
S_OK
,
"GetSourceLineText failed: %08x
\n
"
,
hres
);
todo_wine
ok
(
line_text
!=
NULL
&&
!
lstrcmpW
(
line_text
,
tests
[
i
].
line_text
),
"[%u] GetSourceLineText returned %s expected %s
\n
"
,
i
,
wine_dbgstr_w
(
line_text
),
wine_dbgstr_w
(
tests
[
i
].
line_text
));
}
...
...
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