mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
get refarg is ok
This commit is contained in:
parent
0a0c0fbec8
commit
4f8ab57dc7
@ -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 */
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user