print(a) not ok

This commit is contained in:
lyon 2021-09-05 14:55:11 +08:00
parent 7d0c6c8148
commit ffc9d32cf0
3 changed files with 8 additions and 6 deletions

View File

@ -36,8 +36,9 @@ void block_setBody(PikaObj *self, char *body)
uint8_t block_checkAssert(PikaObj *self)
{
Args *buffs = New_strBuff();
PikaObj *host = obj_getContext(self);
char *assert = block_getAssert(self);
obj_run(self, strsFormat(buffs, 32, "_res = %s", assert));
obj_run(host, strsFormat(buffs, 32, "_res = %s", assert));
int res = obj_getInt(self, "_res");
args_deinit(buffs);
return res;

View File

@ -231,8 +231,7 @@ Args *obj_invoke(PikaObj *self, char *cmd)
Args *res = New_args(NULL);
args_setErrorCode(res, 0);
Args *buffs = New_strBuff();
char *cleanCmd = strsGetCleanCmd(buffs, cmd);
char *methodToken = strsGetFirstToken(buffs, cleanCmd, '(');
char *methodToken = strsGetFirstToken(buffs, cmd, '(');
char *methodPath = methodToken;
Args *args = NULL;
@ -277,7 +276,7 @@ Args *obj_invoke(PikaObj *self, char *cmd)
}
/* get arg list */
char *argList = strsCut(buffs, cleanCmd, '(', ')');
char *argList = strsCut(buffs, cmd, '(', ')');
{
if (argList == NULL)
{

View File

@ -574,14 +574,15 @@ Args *getRightRes(PikaObj *self, char *cmd)
}
res = New_args(NULL);
args_setSysOut(res, "");
int err = args_setLiteral(res, "return", cmd);
int err = obj_getAnyArg(self, "return", cmd, res);
if (err != 0)
{
args_setSysOut(res, "[error] get value faild.");
args_setErrorCode(res, 1);
goto exit;
}
char *returnType = strsAppend(buffs, "->", args_getType(res, "return"));
char *returnType = args_getType(res, "return");
returnType = strsAppend(buffs, "->", returnType);
args_setStr(res, "returnType", returnType);
goto exit;
@ -594,6 +595,7 @@ Args *obj_runScript(PikaObj *self, char *cmd)
{
Args *buffs = New_strBuff();
Args *res = NULL;
cmd = strsGetCleanCmd(buffs, cmd);
/* get right cmd */
char *right = getRightCmd(buffs, cmd);