get refarg is ok

This commit is contained in:
lyon 2021-09-05 14:02:36 +08:00
parent 0a0c0fbec8
commit 4f8ab57dc7
3 changed files with 20 additions and 11 deletions

View File

@ -17,17 +17,12 @@ static int32_t loadArgByType(PikaObj *self,
{
return 0;
}
/* get reference arg */
Arg *arg = obj_getArg(self, argPath);
if (arg == NULL)
if (0 == obj_getRefArg(self, argPath, args))
{
/* can not get arg */
return 3;
return 0;
}
Arg *argCopied = arg_copy(arg);
argCopied = arg_setName(argCopied, argPath);
args_setArg(args, argCopied);
return 0;
/* solve arg faild */
return 3;
}
if (strEqu(definedType, "str"))
{
@ -234,8 +229,6 @@ static void *getMethodPtr(PikaObj *methodHost, char *methodName)
return res;
}
Args *obj_invoke(PikaObj *self, char *cmd)
{
/* the Args returned need to be deinit */

View File

@ -534,6 +534,21 @@ char *getRightCmd(Args *buffs, char *cmd)
return right;
}
uint8_t obj_getRefArg(PikaObj *self, char *argPath, Args *targetArgs)
{
/* get reference arg */
Arg *arg = obj_getArg(self, argPath);
if (arg == NULL)
{
/* can not get arg */
return 3;
}
Arg *argCopied = arg_copy(arg);
argCopied = arg_setName(argCopied, argPath);
args_setArg(targetArgs, argCopied);
return 0;
}
Args *getRightRes(PikaObj *self, char *cmd)
{
Args *buffs = New_strBuff();

View File

@ -81,5 +81,6 @@ void args_setSysOut(Args *args, char *str);
char *obj_getSysOut(PikaObj *self);
void obj_sysPrintf(PikaObj *self, char *fmt, ...);
PikaObj *obj_getContext(PikaObj *self);
uint8_t obj_getRefArg(PikaObj *self, char *argPath, Args *targetArgs);
#endif