ullage
ullage copied to clipboard
Functions Declarations Don't Properly Obey Scopes
When defining nested functions other functions scopes can poison inner ones:
fn foo(): Number
100
end
print foo() # => 100
fn bar(): Number
print foo()
fn foo(): Number
-934
end
print foo()
end
let b = bar() # => -934
# => -934
print b == foo() # => false
This test case will currently fail. The inner foo
declaration will be emitted to the same LLVM function as the outer one. The solution is to mangle each function's name when emitting the LLVM function. Probably best grouped together with #22 and #17.
Maybe we want to keep a side-table of information about each function (return type, parameters, mangled name etc.) in the lower context. We would need a consistent and quick way of finding these declarations.