This commit is contained in:
pikastech 2022-08-05 13:51:13 +08:00
parent 930389306a
commit b47e2795d1
3 changed files with 11 additions and 1 deletions

View File

@ -163,6 +163,7 @@ char* strsPopTokenWithSkip_byStr(Args* outBuffs,
}
char* strsGetCleanCmd(Args* outBuffs, char* cmd) {
pika_assert(cmd!=NULL);
int32_t size = strGetSize(cmd);
/* lexer may generate more chars than input */
char* strOut = args_getBuff(outBuffs, size * 2);
@ -1860,6 +1861,11 @@ AST* AST_parseLine(char* line, Stack* block_stack) {
}
block_matched:
if (NULL == stmt){
AST_deinit(ast);
ast = NULL;
goto exit;
}
stmt = strsGetCleanCmd(&buffs, stmt);
ast = AST_parseStmt(ast, stmt);
goto exit;

View File

@ -1167,7 +1167,10 @@ static Arg* VM_instruction_handler_JEZ(PikaObj* self,
int jmp_expect = fast_atoi(data);
arg_newReg(pika_assertArg_reg, PIKA_ARG_BUFF_SIZE);
Arg* pika_assertArg = stack_popArg(&(vs->stack), &pika_assertArg_reg);
int pika_assert = arg_getInt(pika_assertArg);
int pika_assert = 0;
if (NULL != pika_assertArg) {
pika_assert = arg_getInt(pika_assertArg);
}
arg_deinit(pika_assertArg);
vs->ireg[thisBlockDeepth] = !pika_assert;

View File

@ -269,6 +269,7 @@ Arg* arg_setStr(Arg* self, char* name, char* string) {
}
int64_t arg_getInt(Arg* self) {
pika_assert(NULL!=self);
if (NULL == arg_getContent(self)) {
return -999999;
}