simplifications
This commit is contained in:
@@ -1318,7 +1318,7 @@ JSValue mcode_exec(JSContext *ctx, JSMCode *code, JSValue this_obj,
|
||||
} else {
|
||||
JSValue idx = frame->slots[(int)a3->valuedouble];
|
||||
if (JS_IsInt(idx))
|
||||
val = JS_GetPropertyUint32(ctx, obj, JS_VALUE_GET_INT(idx));
|
||||
val = JS_GetPropertyNumber(ctx, obj, JS_VALUE_GET_INT(idx));
|
||||
else
|
||||
val = JS_GetProperty(ctx, obj, idx);
|
||||
}
|
||||
@@ -1348,7 +1348,8 @@ JSValue mcode_exec(JSContext *ctx, JSMCode *code, JSValue this_obj,
|
||||
JSValue idx = frame->slots[(int)a3->valuedouble];
|
||||
int ret;
|
||||
if (JS_IsInt(idx)) {
|
||||
ret = JS_SetPropertyUint32(ctx, obj, JS_VALUE_GET_INT(idx), val);
|
||||
JSValue r = JS_SetPropertyNumber(ctx, obj, JS_VALUE_GET_INT(idx), val);
|
||||
ret = JS_IsException(r) ? -1 : 0;
|
||||
} else if (JS_IsArray(obj)) {
|
||||
JS_ThrowTypeError(ctx, "array index must be a number");
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
@@ -1517,7 +1518,7 @@ JSValue mcode_exec(JSContext *ctx, JSMCode *code, JSValue this_obj,
|
||||
for (int i = 0; i < nargs; i++, p = p->next) {
|
||||
if (cJSON_IsString(p)) break; /* hit line/col */
|
||||
int areg = (int)p->valuedouble;
|
||||
JS_SetPropertyUint32(ctx, frame->slots[dest], i, frame->slots[areg]);
|
||||
JS_SetPropertyNumber(ctx, frame->slots[dest], i, frame->slots[areg]);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
}
|
||||
JSValue call_args[2] = { key_gc.val, frame->slots[dest] };
|
||||
@@ -1609,7 +1610,7 @@ JSValue mcode_exec(JSContext *ctx, JSMCode *code, JSValue this_obj,
|
||||
cJSON *p = a3->next;
|
||||
for (int i = 0; i < nargs; i++, p = p->next) {
|
||||
int areg = (int)p->valuedouble;
|
||||
JS_SetPropertyUint32(ctx, frame->slots[dest], i, frame->slots[areg]);
|
||||
JS_SetPropertyNumber(ctx, frame->slots[dest], i, frame->slots[areg]);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
}
|
||||
JSValue call_args[2] = { frame->slots[key_reg], frame->slots[dest] };
|
||||
@@ -1758,7 +1759,7 @@ JSValue mcode_exec(JSContext *ctx, JSMCode *code, JSValue this_obj,
|
||||
JSGCRef arg_refs[len > 0 ? len : 1];
|
||||
for (int i = 0; i < len; i++) {
|
||||
JS_PushGCRef(ctx, &arg_refs[i]);
|
||||
arg_refs[i].val = JS_GetPropertyUint32(ctx, frame->slots[arr_slot], i);
|
||||
arg_refs[i].val = JS_GetPropertyNumber(ctx, frame->slots[arr_slot], i);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
}
|
||||
JSValue args[len > 0 ? len : 1];
|
||||
@@ -1790,7 +1791,7 @@ JSValue mcode_exec(JSContext *ctx, JSMCode *code, JSValue this_obj,
|
||||
cJSON *elem = cJSON_GetArrayItem(instr, 3 + i);
|
||||
if (elem) {
|
||||
int elem_slot = (int)elem->valuedouble;
|
||||
JS_SetPropertyUint32(ctx, frame->slots[dest], i, frame->slots[elem_slot]);
|
||||
JS_SetPropertyNumber(ctx, frame->slots[dest], i, frame->slots[elem_slot]);
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user