Closed exander77 closed 8 years ago
No, you'll just need to run escope again.
If my modifications are scope dependent, I would need to run escope again after every single modification. This would be a pretty big overhead.
I already tried several approaches. For example creating new AST for the modified part and running escope on that new AST and if node cannot be resolved in scope of current scope manager, than I tried to resolve it in the scope of scope manager of the original AST, but it seems, that I can't resolve node which does not belong into the tree for which the scope manager was built.
I am using estraverse to modify ast with conjuction of escope. When tree is modifed by adding new function calls, scope manager stops working because estraverse enters the function which scope is unknown to scope manager (acquire returns null/undefined). There should be a feature to update scope manager for newly created code.
Connected with: https://github.com/estools/estraverse/issues/29