You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because macro functions defined inside of a macro function will override existing macro functions, rather than defining macro functions that exist solely within that scope.
This problem extends beyond just overriding macro functions with the same name. Macro functions defined inside of another macro function should not be usable outside of their defined scope. For example:
The second {{ foo() }} is not supposed to output 1, the reason it does it because the macro's definition will get overwritten while evaluating the first {{ foo() }}. It will then call the child foo() on subsequent calls, and only return 1. It will continue to return 1 for the third, fourth, etc calls because the macro function will be overwritten
In jinja, the child macro function's definition does not change the macro functions defined on the global scope, but in jinja, then the definition can impact the global macro functions defined on outer scopes.
The output of:
Should be:
However, in Jinjava, the output is:
This is because macro functions defined inside of a macro function will override existing macro functions, rather than defining macro functions that exist solely within that scope.
This problem extends beyond just overriding macro functions with the same name. Macro functions defined inside of another macro function should not be usable outside of their defined scope. For example:
The final
bar()
should not be calling anything, but the result in Jinjava is:The text was updated successfully, but these errors were encountered: