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 is inserted in the analysis pass into a map from expr ptrs to
metadata in the compilation context itself, this enables codegen to
fetch that metadata with the expr pointer
the other approach was embedding it into the variable expr itself (as
seen by VariableExpr), but that causes a compiler crash
by inserting it before we analyze statements, we allow ourselves to
analyze statements *with the data we already have*, for example, we can
now check the return statements' type, and see if it matches with the
functions' declared return type.
this is done via setting CompilationContext.cur_function on insertFn()
- don't just ignore function analysis if its incomplete, do an error
- add scope ids for debug purposes
- add children to parent on Scope.createChild
- types: add validation of if's condition expr type
- types: add scopes to ifs