-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Aliasing/deconflicting overhaul #401
Conversation
Some other sources of conflicts are:
|
Took care of the issue where |
One more type of collision I just bumped into - renderer function parameters can shadow various top-level identifiers. Perhaps function parameters should also be run through |
I need to take a step back and think about this again. In the meantime I think I'll put together a PR of just the stuff about replacing objects with maps/sets. |
…nch more deconflicting
Updated this again, starting anew from latest master. Quick rundown of what's here -
Known things that are still not getting deconflicted:
|
I guess I'm ready for some sort of review of this, despite the couple of outstanding things. I've been fiddling with this in a vacuum on and off for a few days now, and it would be nice to get some confirmation that I'm not going totally in the wrong direction here :) |
This looks good to me — all makes sense, and generally seems like a better/more unified approach. Is it ready for merge? |
It should be. I'd like to write some more unit tests sometime and to refine some stuff a bit, but I don't think that has to hold up this PR. edit: Actually, with the merging of #407, there might be some stuff from there that has to be updated - the edit again: Oh! Looks like you already took care of that? |
Actually, just fixed a small merge issue with the work in #407 |
This was either less hairy than I was expecting, or I missed something. Existing unit tests still pass, a few other manual tests I've run have also passed.
The idea is to make
getUniqueName
stop colliding with the existingalias
function and also with the user's imports.Generator
has a newgetAliaser
mechanism that returns a new aliasing function. Each aliasing function returns identifiers that don't collide with each other (or with preexisting used identifiers, i.e., imports). We're currently making two such aliasers, one that is used for helpers and other top-level scope stuff as before, and the other that is used for getUniqueName which handles lower-scope stuff.These changes look to be able to cope with a three-way conflict between the
template
top-level variable, atemplate
import, and thetemplate
variable created if you have a component calledTemplate
. I do want to get some unit tests written and just have a chance to think through this some more before I remove the [WIP] from the PR.