This commit is contained in:
Valk Richard Li 2019-11-12 11:07:48 +08:00 committed by GitHub
parent 2989f731e7
commit a61415fbed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 5 deletions

View File

@ -3,9 +3,10 @@
#include "abstract_syntax_tree.h" #include "abstract_syntax_tree.h"
int exit_type=0; int exit_type=0;
bool abstract_syntax_tree::check() var abstract_syntax_tree::condition()
{ {
bool ret=false; var cond;
cond.set_number(0);
if(this->type==__cmp_equal) if(this->type==__cmp_equal)
{ {
@ -18,11 +19,11 @@ bool abstract_syntax_tree::check()
{ {
} }
else if(this->type==__cmp_less_or_equal) else if(this->type==__cmp_more)
{ {
} }
else if(this->type==__cmp_more) else if(this->type==__cmp_less_or_equal)
{ {
} }
@ -38,7 +39,22 @@ bool abstract_syntax_tree::check()
{ {
} }
return true; else
{
}
return cond;
}
bool abstract_syntax_tree::check()
{
bool ret=false;
var cond=condition();
if(cond.get_number()==0)
ret=false;
else
ret=true;
return ret;
} }
var abstract_syntax_tree::call_id() var abstract_syntax_tree::call_id()

View File

@ -184,6 +184,7 @@ class abstract_syntax_tree
{ {
return children; return children;
} }
var condition();
bool check(); bool check();
var call_id(); var call_id();
var get_value(); var get_value();