mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-07-21 10:28:50 +08:00
change name of enum:ast_hashmember->ast_pair, ast_new_iter->ast_iter
change ast_hashmember to ast_pair is because this type in fact is the same as std::pair<std::string,nasal_ref> in C++
This commit is contained in:
+8
-8
@@ -20,14 +20,14 @@ void calc_const_num(nasal_ast& root)
|
||||
double res;
|
||||
switch(root.type())
|
||||
{
|
||||
case ast_add:res=vec[0].num()+vec[1].num();break;
|
||||
case ast_sub:res=vec[0].num()-vec[1].num();break;
|
||||
case ast_mult:res=vec[0].num()*vec[1].num();break;
|
||||
case ast_div:res=vec[0].num()/vec[1].num();break;
|
||||
case ast_less:res=vec[0].num()<vec[1].num();break;
|
||||
case ast_leq:res=vec[0].num()<=vec[1].num();break;
|
||||
case ast_grt:res=vec[0].num()>vec[1].num();break;
|
||||
case ast_geq:res=vec[0].num()>=vec[1].num();break;
|
||||
case ast_add: res=vec[0].num()+vec[1].num(); break;
|
||||
case ast_sub: res=vec[0].num()-vec[1].num(); break;
|
||||
case ast_mult:res=vec[0].num()*vec[1].num(); break;
|
||||
case ast_div: res=vec[0].num()/vec[1].num(); break;
|
||||
case ast_less:res=vec[0].num()<vec[1].num(); break;
|
||||
case ast_leq: res=vec[0].num()<=vec[1].num();break;
|
||||
case ast_grt: res=vec[0].num()>vec[1].num(); break;
|
||||
case ast_geq: res=vec[0].num()>=vec[1].num();break;
|
||||
}
|
||||
if(std::isinf(res) || std::isnan(res)) // inf and nan will cause number hashmap error in codegen
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user