visual update

This commit is contained in:
ValKmjolnir
2022-03-10 16:05:49 +08:00
parent e54ef9620f
commit f26719e1d3
6 changed files with 41 additions and 42 deletions
+8
View File
@@ -37,6 +37,14 @@ void calc_const(nasal_ast& root)
auto& vec=root.child();
for(auto& i:vec)
calc_const(i);
if(vec.size()==1 && root.type()==ast_neg && vec[0].type()==ast_num)
{
double res=-vec[0].num();
root.set_num(res);
root.child().clear();
root.set_type(ast_num);
return;
}
if(vec.size()!=2)
return;
if(root.type()!=ast_add &&