-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix inconsistencies when invoking functions with implicit objects #1061
Conversation
no tests? |
Hey donjones ... thanks for this patch -- very, very exciting stuff. Not being able to write I'm not entirely comfortable with doing the rewriting at CallNode compile time -- it should probably be put as a step in the Rewriter, even if it takes an additional pass to accomplish. Merged at SHA: 53dc1f2. Thanks again. |
Quoting satyr at 618:
The old behavior was actually more consistent. The question is: Is this purely a special-case hack, or is it a starting point for a more general fix? It should be kept on master only if it's in the second category. |
I agree with satyr and TrevorBurnham here: if we can't (or won't) make it consistent and working for those cases, we should revert this. |
these cases break the hack, but they are reported as errors at least. it was very easy to shoot yourself into the foot with the old behavior.
what about disabling implicit values in implicit braces in all positions? i am currently trying to improve the fix. but i need to take another route, because the rewriter is getting in my way. |
i now tried a grammar based approach, it just works for one-liners, because the rewriting needs to be changed, (but that code looks pretty scary). For one-liners it should work with every possible combination. this version is in: https://github.com/donjones/coffee-script/tree/implicit-object-grammar-fix |
Yep -- we'll revert it if we can't make it consistent. And it's definitely going to be on master only, not For what it's worth it now handles simple array expansions as well:
|
Simply swapping
|
Sorry I haven't done this yet! I want to run my app (not just the tests) to check if everything is working properly. But, on the date this feature got in, the app was in the middle of a restructuring... Then I got caught up in some other urgent stuff... Finally things have settled down. Today (and for the next few days) I'll be finishing the restructuring... By tomorrow I should be able to run the relevant tests. And, in a few days, I'll be able to run the whole app to check if this feature works well with the several code variations I've got. |
Here's another related parse error:
edit: and another:
|
(Sorry for taking so much time to come back with my findings -- I've been really busy fixing my app's bugs...) After checking my source code for some time, I realize that the main (and possibly only) use-cases I have are in this form:
So I guess there's no point in me creating another version of my source code without the |
With the paren/brace merge in the Rewriter, these are all compiling successfully now. |
Modifies AST by moving values from within implicit objects to surrounding function call.
Fixes: #618
Related: #1008 #873 #631