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

[Eager Execution] Pass eager child context updates on to the parent #632

Merged
merged 5 commits into from
Apr 8, 2021

Conversation

jasmith-hs
Copy link
Contributor

When execution within a child context, if there are changes made to the context, then those changes should happen to the parent context as that is what would happen in default execution. This could happen in a custom function that when run in an expression node, adds or changes some value on the context.

This can be accomplished by copying over the child's session bindings. Changes to __macros__ are ignored because it's a hidden context variable.

@jasmith-hs
Copy link
Contributor Author

In order to properly handle the context updates when a deferred value is encountered and we're evaluating within a deferred execution mode (such as when eagerly evaluating If-Else branches), we combine the session mappings with the prefix to preserve state. If we're running in a deferred execution mode, then we won't put the new changes on the context, and will instead convert them to a set tag. Otherwise, we can apply the new changes to the context as would happen with Default Jinjava execution.

@jasmith-hs jasmith-hs merged commit f070554 into master Apr 8, 2021
@jasmith-hs jasmith-hs deleted the pass-on-child-updates branch April 8, 2021 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants