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.
See associated discussion on js implementation:
And the pull request which I tried to port here:
I think this is a very helpful feature for people sharing templates between .java and .js as it can be used to replace simple helper functions which otherwise would require two implementations (one in java and one in javascript).
Note that it currently only passes a simpler test than the original pull request, because accessing the parent context seems to require a change to the parser which I did not want to dive into before I know that this has a chance of actually going in. I'd be happy to implement it though if you point me to the right place to make the change :)
I also think that the merge method should be refactored to the Context class itself but wanted the change to be minimally invasive for now so people who need this can easily add it to their own code.