add codegen for allocating vardecls onto stack (not init yet)
codegen pass needs type information about the variable. thankfully, analyze pass already did the hard work for it, and scope info has types of all its declared names. we use that info to generate the alloca to have information about which current scope we are, we add a "child index" to scopes so we can repoint current context at them instead of bumpScope(), which always creates new, empty ones. initializer exprs are next
This commit is contained in:
parent
77c88fad34
commit
d235ce0d13
4 changed files with 52 additions and 18 deletions
|
@ -32,13 +32,12 @@ fn test_function() B {
|
|||
}
|
||||
|
||||
fn multwo(num: i32, double_flag: bool) i32 {
|
||||
// TODO resolve expr variables
|
||||
if (true) {
|
||||
if (double_flag) {
|
||||
var truthy = true;
|
||||
return 1 * 2;
|
||||
return num * 2;
|
||||
} else {
|
||||
var falsey = false;
|
||||
return 1;
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue