create LST when input tuple

This commit is contained in:
pikastech 2022-07-11 23:32:30 +08:00
parent 0921ee69c4
commit 5e1f0afc5d
3 changed files with 24 additions and 3 deletions

View File

@ -3538,3 +3538,19 @@ TEST(parser, branket_issue4) {
EXPECT_EQ(pikaMemNow(), 0);
}
#endif
TEST(parser, tuple1) {
pikaMemInfo.heapUsedMax = 0;
Args* buffs = New_strBuff();
char* lines = "(a,b)\n";
__platform_printf("%s\n", lines);
char* pikaAsm = Parser_multiLineToAsm(buffs, lines);
__platform_printf("%s", pikaAsm);
EXPECT_STREQ(pikaAsm,
"B0\n"
"1 REF a\n"
"1 REF b\n"
"0 RUN\n");
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
}

View File

@ -686,9 +686,14 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self, VMState* vs, char* data) {
vs->try_error_code == TRY_STATE_INNER) {
sub_try_info.try_state = TRY_STATE_INNER;
}
/* return arg directly */
if (strEqu(data, "")) {
return_arg = stack_popArg(&(vs->stack));
if (VMState_getInputArgNum(vs) < 2) {
/* return arg directly */
return_arg = stack_popArg(&(vs->stack));
goto exit;
}
/* create a tuple */
return_arg = VM_instruction_handler_LST(self, vs, "");
goto exit;
}
/* return tiny obj */

View File

@ -2,4 +2,4 @@
#define PIKA_VERSION_MINOR 9
#define PIKA_VERSION_MICRO 0
#define PIKA_EDIT_TIME "2022/07/11 16:37:09"
#define PIKA_EDIT_TIME "2022/07/11 23:32:26"