Open arv opened 9 years ago
@vojtajina @tpodom
I'm thinking to do this we would need to keep a map of variable names to type annotation per scope. We could follow the block binding transformer for what the scopes are. Maybe we could refactor the core of that logic to reuse it in both transformers?
Do you think that sounds like the right track or am I missing something easier?
I think it's best not to assume the block binding has renamed in case the output language is es6.
On Nov 10, 2014, at 3:13 PM, Erik Arvidsson notifications@github.com wrote:
@vojtajina @tpodom
— Reply to this email directly or view it on GitHub.
Take a look at the ScopeVisitor and related classes. The scope visitor builds up the scope tree so that will give you the map you need. The scope contains the original binding but now that I look it does not include possible type annotations. That would need to be added.
Isn't trapping writes in expressions the more difficult part of the problem?
Given:
This should generate a runtime type assertion error. However, we only add the asserts to variable declarations.