mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
fix invalid access when method_arg is void
This commit is contained in:
parent
607591d78c
commit
f888b32e92
2
port/linux/.vscode/launch.json
vendored
2
port/linux/.vscode/launch.json
vendored
@ -11,7 +11,7 @@
|
||||
"program": "${workspaceFolder}/build/test/pikascript_test",
|
||||
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
|
||||
"args": [
|
||||
// "--gtest_filter=parser.json_literal"
|
||||
"--gtest_filter=module.cmodule_import"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
|
@ -29,8 +29,9 @@ TEST(module, cmodule_import) {
|
||||
/* assert */
|
||||
/* deinit */
|
||||
EXPECT_STREQ("NameError: name 'TemplateDevice.qqee' is not defined\r\n",
|
||||
log_buff[5]);
|
||||
EXPECT_STREQ("NameError: name 'qqee' is not defined\r\n",
|
||||
log_buff[2]);
|
||||
EXPECT_STREQ("BEGIN\r\n", log_buff[3]);
|
||||
obj_deinit(pikaMain);
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
sh only_make.sh
|
||||
if [ $# == 0 ] ; then
|
||||
valgrind -s --track-origins=yes --leak-check=full --show-leak-kinds=all build/test/pikascript_test
|
||||
valgrind -s --track-origins=yes --leak-check=full --show-leak-kinds=all --exit-on-first-error=yes build/test/pikascript_test
|
||||
fi
|
||||
|
||||
if [ $# == 1 ] ; then
|
||||
|
@ -9,6 +9,9 @@ class BaseObj(TinyObj):
|
||||
class pointer:
|
||||
pass
|
||||
|
||||
class any:
|
||||
pass
|
||||
|
||||
def print(val: any):
|
||||
pass
|
||||
|
||||
|
@ -354,14 +354,12 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self, VMState* vs, char* data) {
|
||||
method_arg = obj_getMethodArg(vs->globals, methodPath);
|
||||
}
|
||||
/* assert method*/
|
||||
if (NULL == method_arg) {
|
||||
if (NULL == method_arg || ARG_TYPE_VOID == arg_getType(method_arg)) {
|
||||
/* error, method no found */
|
||||
VMState_setErrorCode(vs, 2);
|
||||
__platform_printf("NameError: name '%s' is not defined\r\n", data);
|
||||
|
||||
goto exit;
|
||||
}
|
||||
|
||||
sub_locals = New_PikaObj();
|
||||
/* load args from vmState to sub_local->list */
|
||||
arg_num_used = VMState_loadArgsFromMethodArg(
|
||||
|
Loading…
x
Reference in New Issue
Block a user