fix: bug in Any2String
This commit is contained in:
@ -52,7 +52,7 @@ std::any FucntionContainer::CallFunction(
|
||||
if (name == "print") {
|
||||
bool is_first = true;
|
||||
for (int i = 0; i < args.size(); i++) {
|
||||
if (is_first) std::cout << ' ';
|
||||
if (!is_first) std::cout << ' ';
|
||||
is_first = false;
|
||||
std::string buf = Any2String(args[i].value);
|
||||
std::cout << buf;
|
||||
@ -125,10 +125,13 @@ std::any FucntionContainer::CallFunction(
|
||||
std::any res = vis.visit(func.code_address);
|
||||
Variables.DestroyFrame();
|
||||
FlowType *flow = std::any_cast<FlowType>(&res);
|
||||
if(!flow)
|
||||
{
|
||||
if(flow->ReturnValueLists.size()==1) return flow->ReturnValueLists[0];
|
||||
else return flow->ReturnValueLists;
|
||||
if (!flow) {
|
||||
if (flow->ReturnValueLists.size() == 0)
|
||||
return NoneType();
|
||||
else if (flow->ReturnValueLists.size() == 1)
|
||||
return flow->ReturnValueLists[0];
|
||||
else
|
||||
return flow->ReturnValueLists;
|
||||
}
|
||||
return NoneType();
|
||||
}
|
Reference in New Issue
Block a user