Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions Declarations Don't Properly Obey Scopes #25

Open
iwillspeak opened this issue Jan 27, 2019 · 0 comments
Open

Functions Declarations Don't Properly Obey Scopes #25

iwillspeak opened this issue Jan 27, 2019 · 0 comments
Labels

Comments

@iwillspeak
Copy link
Owner

iwillspeak commented Jan 27, 2019

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.

@iwillspeak iwillspeak added this to TODO in Ullage 0.1 Jan 27, 2019
@iwillspeak iwillspeak changed the title Functions Declarations Don't Obey Scopes Functions Declarations Don't Properly Obey Scopes Jan 28, 2019
@iwillspeak iwillspeak removed this from TODO in Ullage 0.1 Feb 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant