Fix operation order

This commit is contained in:
Augusto Gunsch 2021-01-07 18:11:21 -03:00
parent 80a3e1ef0f
commit 1784599e72
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 4 additions and 1 deletions

View File

@ -204,15 +204,18 @@ LINEBLOCK* compileterm(SCOPE* s, DEBUGINFO* d, TERM* t) {
// Dealing with whole expressions
LINEBLOCK* compileexpression(SCOPE* s, DEBUGINFO* d, TERM* e) {
LINEBLOCK* blk = NULL;
LINEBLOCK* ops = NULL;
if(e != NULL) {
while(true) {
blk = mergelnblks(blk, compileterm(s, d, e));
if(e->next == NULL)
break;
appendln(blk, mathopln(e->op));
ops = mergelnblks(ops, mklnblk(mathopln(e->op)));
e = e->next;
}
}
if(ops != NULL)
blk = mergelnblks(blk, ops);
return blk;
}