-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Refactor AST inlining and use Variable objects #80
Merged
+920
−1,157
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The goal of this change is to make the AST inlining more maintainable and less complex. Furthermore, we want the Variable objects to encode more information for debugging purposes. Currently, AST inlining is essentially encoded in the inliners, which operate on demand and add variable slots lazily. With this rewrite, AST splitting and inlining is done based on the tree of scopes. Thus, the correct construction of frame slots and variable objects in localized in one place. And, it is done eagerly based on upfront knowledge, so that bugs hopefully aren’t hidden, which they were by the on-demand approach. - moved visitor into inlining package - populate lexical scopes eagerly with embedded info needed for the inlining at parse time, because we need the info directly once the parsing of the embedded scope is completed. - variables are now equal if they refer to the same lexical entity - when correcting ASTs after inlining/splitting, lookup variables in scope tree - make sure scope tree updates embedded methods, need to be split, and inlined methods/blocks need to be removed Signed-off-by: Stefan Marr <git@stefan-marr.de>
Not sure what the purpose here was but this seems just to be incorrect. How could we allow these non-failing incorrect additions? Addition should only be done on declaration. Unclear, are there any bugs going to be popping up because of this? Signed-off-by: Stefan Marr <git@stefan-marr.de>
- initializer setVars needs to happen after primary factory method arguments were added - make sure method is set after splitting scope Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Does not have a real purpose anymore. Signed-off-by: Stefan Marr <git@stefan-marr.de>
This test is outdated, because it isn’t used by VS code debugger. Should adapt Kompos to use the new infrastructure, too. Signed-off-by: Stefan Marr <git@stefan-marr.de>
- minimize duplicated code - use helpers to update variables - refactor code to handle adaptation and spliting in Method Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
fa9f257
to
b71ca3e
Compare
3 tasks
smarr
added a commit
that referenced
this pull request
Jan 18, 2017
Signed-off-by: Stefan Marr <git@stefan-marr.de>
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal of this change is to make the AST inlining more maintainable and
less complex. Furthermore, we want the Variable objects to encode more
information for debugging purposes.
Currently, AST inlining is essentially encoded in the inliners,
which operate on demand and add variable slots lazily.
With this rewrite, AST splitting and inlining is done based on the
tree of scopes. Thus, the correct construction of frame slots and
variable objects is localized in one place. And, it is done eagerly
based on upfront knowledge, so that bugs hopefully aren’t hidden,
which they were by the on-demand approach.
Thus, first, we construct the
MethodScope
tree now, keep all relevant info about variables there, and adapt it when inlining/splitting first, before making a pass over the AST. The pass over the AST uses a visitor that just looks up the new info in the scope tree.needed for the inlining at parse time, because we need the info directly
once the parsing of the embedded scope is completed.
scope tree
inlined methods/blocks need to be removed