jscript: Also add function name to its detached scope in ES5 mode.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cdee7c9cd5
commit
c6a75d4936
|
@ -573,6 +573,7 @@ HRESULT jsval_strict_equal(jsval_t lval, jsval_t rval, BOOL *ret)
|
|||
|
||||
static HRESULT detach_scope(script_ctx_t *ctx, call_frame_t *frame, scope_chain_t *scope)
|
||||
{
|
||||
function_code_t *func = frame->function;
|
||||
unsigned int i, index;
|
||||
HRESULT hres;
|
||||
|
||||
|
@ -591,6 +592,9 @@ static HRESULT detach_scope(script_ctx_t *ctx, call_frame_t *frame, scope_chain_
|
|||
scope->obj = to_disp(scope->jsobj);
|
||||
}
|
||||
|
||||
if (scope == frame->base_scope && func->name && ctx->version >= SCRIPTLANGUAGEVERSION_ES5)
|
||||
jsdisp_propput_name(scope->jsobj, func->name, jsval_obj(jsdisp_addref(frame->function_instance)));
|
||||
|
||||
index = scope->scope_index;
|
||||
for(i = 0; i < frame->function->local_scopes[index].locals_cnt; i++)
|
||||
{
|
||||
|
|
|
@ -1447,6 +1447,35 @@ sync_test("functions scope", function() {
|
|||
val = with_function();
|
||||
ok(val == 8, "val != 8");
|
||||
ok(w == 9, "w != 9");
|
||||
|
||||
var func, func_outer, ret;
|
||||
var o = new Object();
|
||||
|
||||
func_outer = function e()
|
||||
{
|
||||
function func_inner()
|
||||
{
|
||||
ok(typeof e == "function", "typeof e == " + typeof e);
|
||||
ret = e
|
||||
}
|
||||
func = func_inner
|
||||
}
|
||||
func_outer();
|
||||
func();
|
||||
ok(ret === func_outer, "ret != func_outer");
|
||||
|
||||
func_outer = function f(f)
|
||||
{
|
||||
function func_inner()
|
||||
{
|
||||
ok(typeof f == "object", "typeof f == " + typeof f);
|
||||
ret = f
|
||||
}
|
||||
func = func_inner
|
||||
}
|
||||
func_outer(o);
|
||||
func();
|
||||
ok(ret === o, "ret != o");
|
||||
});
|
||||
|
||||
sync_test("console", function() {
|
||||
|
|
Loading…
Reference in New Issue