string indexing
This commit is contained in:
@@ -1932,8 +1932,21 @@ JSValue mcode_exec(JSContext *ctx, JSMCode *code, JSValue this_obj,
|
||||
if (iname) {
|
||||
JSValue key = JS_NewString(ctx, iname);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
JSValue val = JS_GetProperty(ctx, ctx->global_obj, key);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
/* Try env (outer_frame) first, then global */
|
||||
JSFunction *cur_fn = JS_VALUE_GET_FUNCTION(frame->function);
|
||||
JSValue env = (cur_fn && cur_fn->kind == JS_FUNC_KIND_MCODE)
|
||||
? cur_fn->u.mcode.outer_frame : JS_NULL;
|
||||
JSValue val = JS_NULL;
|
||||
if (!JS_IsNull(env)) {
|
||||
val = JS_GetProperty(ctx, env, key);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
}
|
||||
if (JS_IsNull(val)) {
|
||||
key = JS_NewString(ctx, iname);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
val = JS_GetProperty(ctx, ctx->global_obj, key);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
}
|
||||
if (JS_IsNull(val)) {
|
||||
key = JS_NewString(ctx, iname);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
|
||||
Reference in New Issue
Block a user