mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
fix fullthrough on vm
This commit is contained in:
parent
214f3b87fa
commit
480134b68e
16
src/PikaVM.c
16
src/PikaVM.c
@ -677,18 +677,22 @@ static Arg* VM_instruction_handler_REF(PikaObj* self,
|
||||
if (strEqu(arg_path, (char*)"True")) {
|
||||
return arg_setInt(arg_ret_reg, "", 1);
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
if (strEqu(arg_path, (char*)"False")) {
|
||||
return arg_setInt(arg_ret_reg, "", 0);
|
||||
}
|
||||
break;
|
||||
case 'N':
|
||||
if (strEqu(arg_path, (char*)"None")) {
|
||||
return arg_setNull(arg_ret_reg);
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
if (strEqu(arg_path, (char*)"RuntimeError")) {
|
||||
return arg_setInt(arg_ret_reg, "", PIKA_RES_ERR_RUNTIME_ERROR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Arg* res = NULL;
|
||||
@ -754,7 +758,8 @@ static Arg* VM_instruction_handler_REF(PikaObj* self,
|
||||
exit:
|
||||
if (NULL == res) {
|
||||
VMState_setErrorCode(vm, PIKA_RES_ERR_ARG_NO_FOUND);
|
||||
pika_platform_printf("NameError: name '%s' is not defined\r\n", arg_path);
|
||||
pika_platform_printf("NameError: name '%s' is not defined\r\n",
|
||||
arg_path);
|
||||
} else {
|
||||
res = arg_copy_noalloc(res, arg_ret_reg);
|
||||
}
|
||||
@ -1607,7 +1612,8 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self,
|
||||
if (NULL == method || ARG_TYPE_NONE == arg_getType(method)) {
|
||||
/* error, method no found */
|
||||
VMState_setErrorCode(vm, PIKA_RES_ERR_ARG_NO_FOUND);
|
||||
pika_platform_printf("NameError: name '%s' is not defined\r\n", run_path);
|
||||
pika_platform_printf("NameError: name '%s' is not defined\r\n",
|
||||
run_path);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -3292,7 +3298,8 @@ static void instructUnit_printWithConst(InstructUnit* self,
|
||||
// if (instructUnit_getIsNewLine(self)) {
|
||||
// pika_platform_printf("B%d\r\n", instructUnit_getBlockDeepth(self));
|
||||
// }
|
||||
pika_platform_printf("%s %s \t\t(#%d)\r\n", instructUnit_getInstructStr(self),
|
||||
pika_platform_printf(
|
||||
"%s %s \t\t(#%d)\r\n", instructUnit_getInstructStr(self),
|
||||
constPool_getByOffset(const_pool, self->const_pool_index),
|
||||
self->const_pool_index);
|
||||
}
|
||||
@ -3347,7 +3354,8 @@ void instructArray_printAsArray(InstructArray* self) {
|
||||
}
|
||||
for (int i = 0; i < (int)instructUnit_getSize(); i++) {
|
||||
g_i++;
|
||||
pika_platform_printf("0x%02x, ", *((uint8_t*)ins_unit + (uintptr_t)i));
|
||||
pika_platform_printf("0x%02x, ",
|
||||
*((uint8_t*)ins_unit + (uintptr_t)i));
|
||||
if (g_i % line_num == 0) {
|
||||
pika_platform_printf("\n");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user