fixed bugs

This commit is contained in:
Valk Richard Li
2019-11-14 16:53:29 +08:00
committed by GitHub
parent ac3b5719bc
commit f0053576b3
3 changed files with 18 additions and 8 deletions

View File

@@ -449,7 +449,9 @@ var abstract_syntax_tree::call_identifier()
if(temp.get_type()==__null_type)
{
exit_type=__get_value_failure;
std::cout<<">>[Runtime-error] line "<<line<<": cannot find a hash-member named \'"<<i->name<<"\'."<<std::endl;
std::cout<<">>[Runtime-error] line "<<line<<": cannot find a hash-member named \'"<<i->name<<"\' or this value is set to __null_type. detail: ";
temp.print_var();
std::cout<<"."<<std::endl;
break;
}
}
@@ -732,12 +734,12 @@ int abstract_syntax_tree::run_ifelse()
scope.add_new_local_scope();
for(std::list<abstract_syntax_tree>::iterator i=children.begin();i!=children.end();++i)
{
if(i->type!=__else && i->children.front().condition_check())
if((i->type==__if || i->type==__elsif) && i->children.front().condition_check())
{
ret=i->children.back().run_block();
break;
}
else
else if(i->type==__else)
{
ret=i->children.back().run_block();
break;