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

Do not resolve up when setting a variable in macro. #653

Merged
merged 2 commits into from
Jan 29, 2016

Conversation

oyyd
Copy link
Contributor

@oyyd oyyd commented Jan 28, 2016

This PR should fix #577 and the "macro" part of issue #561.

@@ -7,10 +7,11 @@ var Obj = require('./object');
// we know how to access variables. Block tags can introduce special
// variables, for example.
var Frame = Obj.extend({
init: function(parent) {
init: function(parent, inMacro) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about using a more generic name for this new parameter; something like isolate? It seems likely to me that this same parameter might prove useful in solving the other portions of #561, in which case the name inMacro might no longer apply.

Copy link
Contributor

Choose a reason for hiding this comment

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

Though since it's internal, we can also leave it as-is for now and rename it later if necessary; I'm fine with that if you prefer.

@carljm
Copy link
Contributor

carljm commented Jan 28, 2016

This is great!! Thank you so much for all your work on nunjucks.

I made a few small comments above. Also, while you're updating the PR anyway, maybe add an entry to changelog? Thanks!

@carljm
Copy link
Contributor

carljm commented Jan 28, 2016

(The changelog comment can just be something like "Fix {% set %} scoping within macros. Fixes #577 and the macro portion of #561. Thanks Ouyang Yadong. Merge of #653." -- where all the issue and PR links are Markdown links.)

@carljm
Copy link
Contributor

carljm commented Jan 28, 2016

(Also, please comment here if you push another commit, GitHub doesn't notify when new commits are pushed to a PR.)

@oyyd
Copy link
Contributor Author

oyyd commented Jan 29, 2016

Hi, @carljm. Thanks for your detailed comments which help a lot! :-) And I have add another test to make the test case more clear.

Maybe you can add me as a collaborator and I would like to help to improve Chinese docs(merge some PRs or make some PRs by myself). Simply ignore it if you don't think that's appropriate .

@carljm
Copy link
Contributor

carljm commented Jan 29, 2016

@oyyd Sure, I'd be happy to add you as a collaborator to work on Chinese docs. I'd prefer if you get a review from someone before merging code that touches src/* (I do the same myself).

@carljm
Copy link
Contributor

carljm commented Jan 29, 2016

Looks great, thank you!

carljm added a commit that referenced this pull request Jan 29, 2016
Do not resolve up when setting a variable in macro.
@carljm carljm merged commit a9b85a8 into mozilla:master Jan 29, 2016
carljm added a commit that referenced this pull request Jan 29, 2016
Do not resolve up when setting a variable in macro.
@oyyd
Copy link
Contributor Author

oyyd commented Jan 30, 2016

@carljm Thank you. And I will continue to do PRs in other situations.

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.

Macro recursion issue: Variables in macros are not stored on the stack
2 participants