Skip to content

Commit

Permalink
Pass resolved expressions up parent context chain
Browse files Browse the repository at this point in the history
  • Loading branch information
jmp3833 committed Aug 28, 2017
1 parent 0c15fa0 commit 31dc5ff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/hubspot/jinjava/el/ExpressionResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.apache.commons.lang3.exception.ExceptionUtils.getRootCauseMessage;

import java.util.List;
import java.util.Optional;

import javax.el.ELException;
import javax.el.ExpressionFactory;
Expand Down Expand Up @@ -61,6 +62,7 @@ public Object resolveExpression(String expression) {
}

interpreter.getContext().addResolvedExpression(expression.trim());
Optional.ofNullable(interpreter.getContext().getParent()).ifPresent(parent -> parent.addResolvedExpression(expression.trim()));

try {
String elExpression = "#{" + expression.trim() + "}";
Expand Down

1 comment on commit 31dc5ff

@boulter
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe addResolvedExpression should just recursively add up the parent context chain?

Please sign in to comment.