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

Improve inlining #661

Merged
merged 7 commits into from May 16, 2020
Merged

Improve inlining #661

merged 7 commits into from May 16, 2020

Conversation

fabiosantoscode
Copy link
Collaborator

I believe I've improved some aspects of inlining. It became a bit simpler than before. Also, inlining something updates more scope of the parent scope's information than before, fixing #639.

My original goal was to make it so new, unique variable names were always created, and checking for collisions didn't need to happen, but it turns out that generating new names didn't fix all the problems, and people would probably be upset or confused if their variable names were changed without them using the mangle option.

Then I tacked on a change I was interested in, which was to start measuring symbols differently depending on whether mangling was enabled, fixing #321.

Copy link
Contributor

@L2jLiga L2jLiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall great job!
I really like how it's done!

@@ -3522,6 +3533,7 @@ const pure_prop_access_globals = new Set([
return true;
}
if (node instanceof AST_This && this instanceof AST_Arrow) {
// TODO check arguments too!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you continue work on that in this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, just a note for later. This is because arguments can be used inside arrow functions and it uses the closest non-arrow arguments just like it does with this.

@L2jLiga
Copy link
Contributor

L2jLiga commented May 2, 2020

@fabiosantoscode what is status of this PR? :)

@fabiosantoscode fabiosantoscode merged commit 0f6255f into master May 16, 2020
@fabiosantoscode fabiosantoscode deleted the improve-inlining branch May 16, 2020 16:46
fabiosantoscode added a commit that referenced this pull request Aug 1, 2020
* enable symbols to be created during compression while maintaining most figure_out_scope information

* simplify reduce_vars inlining code

* remove _ arguments in parse

* add this._toplevel to Compressor

* recompute scope when inlining a function

* remove old TODO comment

* deprecate var_names()
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

Successfully merging this pull request may close these issues.

None yet

2 participants