adam-mcdaniel / oakc

A portable programming language with a compact intermediate representation
Apache License 2.0
725 stars 21 forks source link

Fix/if #91

Closed adam-mcdaniel closed 3 years ago

adam-mcdaniel commented 3 years ago

Before, all if statements were managed by hidden %IF_VAR% and %ELSE_VAR% variables used as the conditions. This is because loops and if statements function identically in the backend, so if statements must have some way to exit the loop. This works perfectly for nested if statements, but the problem really arises with nested if else statements. Now, these variables are numbered as they are assembled into Asm by Mir, similarly to how instances of non-memcopy structures are assigned numbered hidden variables.