adam-mcdaniel / oakc

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

Fixed typechecking of function calls and fixed else if statements #90

Closed adam-mcdaniel closed 3 years ago

adam-mcdaniel commented 3 years ago

Before, else if statements were accidentally processed in the wrong order. The first case, the if case, would be evaluated, then all of the else if branches would be evaluated in reverse order, and then the else case would be evaluated. This has been fixed by reversing the else if cases when they are assembled into if else statements.

Additionally, I discovered that the arguments of function calls were not being typechecked. I have no idea how I let this get through the cracks. I just added typechecks to each argument directly after their types were checked against the function argument types.