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

The map variableType is global, so it can't distinguish var in different scopes #37

Open
z2z23n0 opened this issue Jun 28, 2020 · 2 comments

Comments

@z2z23n0
Copy link
Member

z2z23n0 commented Jun 28, 2020

For example:
If I define a var which named a in function foo, and then I define another var named a in function bar.
In this case, foo::a and bar::a will be same in variableType.

@atlas-comstock
Copy link
Member

map[package]map[function]map[variable][value] seems like a good method

@z2z23n0
Copy link
Member Author

z2z23n0 commented Jun 29, 2020

Looks like I've got the wrong reason of the bug, the value in maps will update when another var named a is defined.
The real reason is: if last a is a param in another function, it will be decorated as BETTERGOPARAMa, and this var won't be released when it's out of scope.
The bug is in here (translator/expr.go):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants