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
fc5a8836
Commit
fc5a8836
authored
Sep 09, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 09, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added scope chain implementation.
parent
86a787bb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
4 deletions
+48
-4
engine.c
dlls/jscript/engine.c
+31
-2
engine.h
dlls/jscript/engine.h
+16
-1
jscript.c
dlls/jscript/jscript.c
+1
-1
No files found.
dlls/jscript/engine.c
View file @
fc5a8836
...
...
@@ -96,7 +96,19 @@ static void exprval_set_idref(exprval_t *val, IDispatch *disp, DISPID id)
IDispatch_AddRef
(
disp
);
}
HRESULT
create_exec_ctx
(
exec_ctx_t
**
ret
)
void
scope_release
(
scope_chain_t
*
scope
)
{
if
(
--
scope
->
ref
)
return
;
if
(
scope
->
next
)
scope_release
(
scope
->
next
);
IDispatchEx_Release
(
_IDispatchEx_
(
scope
->
obj
));
heap_free
(
scope
);
}
HRESULT
create_exec_ctx
(
scope_chain_t
*
scope
,
exec_ctx_t
**
ret
)
{
exec_ctx_t
*
ctx
;
...
...
@@ -104,6 +116,11 @@ HRESULT create_exec_ctx(exec_ctx_t **ret)
if
(
!
ctx
)
return
E_OUTOFMEMORY
;
if
(
scope
)
{
scope_addref
(
scope
);
ctx
->
scope_chain
=
scope
;
}
*
ret
=
ctx
;
return
S_OK
;
}
...
...
@@ -113,6 +130,8 @@ void exec_release(exec_ctx_t *ctx)
if
(
--
ctx
->
ref
)
return
;
if
(
ctx
->
scope_chain
)
scope_release
(
ctx
->
scope_chain
);
heap_free
(
ctx
);
}
...
...
@@ -239,13 +258,23 @@ HRESULT exec_source(exec_ctx_t *ctx, parser_ctx_t *parser, source_elements_t *so
/* ECMA-262 3rd Edition 10.1.4 */
static
HRESULT
identifier_eval
(
exec_ctx_t
*
ctx
,
BSTR
identifier
,
DWORD
flags
,
exprval_t
*
ret
)
{
scope_chain_t
*
scope
;
named_item_t
*
item
;
DISPID
id
=
0
;
HRESULT
hres
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
identifier
));
/* FIXME: scope chain */
for
(
scope
=
ctx
->
scope_chain
;
scope
;
scope
=
scope
->
next
)
{
hres
=
dispex_get_id
(
_IDispatchEx_
(
scope
->
obj
),
identifier
,
0
,
&
id
);
if
(
SUCCEEDED
(
hres
))
break
;
}
if
(
scope
)
{
exprval_set_idref
(
ret
,
(
IDispatch
*
)
_IDispatchEx_
(
scope
->
obj
),
id
);
return
S_OK
;
}
hres
=
dispex_get_id
(
_IDispatchEx_
(
ctx
->
parser
->
script
->
global
),
identifier
,
0
,
&
id
);
if
(
SUCCEEDED
(
hres
))
{
...
...
dlls/jscript/engine.h
View file @
fc5a8836
...
...
@@ -56,10 +56,25 @@ static inline void *parser_alloc_tmp(parser_ctx_t *ctx, DWORD size)
return
jsheap_alloc
(
&
ctx
->
tmp_heap
,
size
);
}
typedef
struct
_scope_chain_t
{
LONG
ref
;
DispatchEx
*
obj
;
struct
_scope_chain_t
*
next
;
}
scope_chain_t
;
HRESULT
scope_push
(
scope_chain_t
*
,
DispatchEx
*
,
scope_chain_t
**
);
void
scope_release
(
scope_chain_t
*
);
static
inline
void
scope_addref
(
scope_chain_t
*
scope
)
{
scope
->
ref
++
;
}
struct
_exec_ctx_t
{
LONG
ref
;
parser_ctx_t
*
parser
;
scope_chain_t
*
scope_chain
;
};
static
inline
void
exec_addref
(
exec_ctx_t
*
ctx
)
...
...
@@ -68,7 +83,7 @@ static inline void exec_addref(exec_ctx_t *ctx)
}
void
exec_release
(
exec_ctx_t
*
);
HRESULT
create_exec_ctx
(
exec_ctx_t
**
);
HRESULT
create_exec_ctx
(
scope_chain_t
*
,
exec_ctx_t
**
);
HRESULT
exec_source
(
exec_ctx_t
*
,
parser_ctx_t
*
,
source_elements_t
*
,
jsexcept_t
*
,
VARIANT
*
);
typedef
struct
_statement_t
statement_t
;
...
...
dlls/jscript/jscript.c
View file @
fc5a8836
...
...
@@ -80,7 +80,7 @@ static HRESULT exec_global_code(JScript *This, parser_ctx_t *parser_ctx)
VARIANT
var
;
HRESULT
hres
;
hres
=
create_exec_ctx
(
&
exec_ctx
);
hres
=
create_exec_ctx
(
NULL
,
&
exec_ctx
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
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