Skip to content

Commit 05dc664

Browse files
lukesandbergcopybara-github
authored andcommitted
Fix a bug in toSourceString by ensuring that grouping parens are added when needed
PiperOrigin-RevId: 658538818
1 parent 7c2ec2c commit 05dc664

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

java/src/com/google/template/soy/exprtree/DataAccessNode.java

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ public final SourceLocation getAccessSourceLocation() {
8080

8181
@Override
8282
public String toSourceString() {
83+
if (SoyPrecedence.shouldGuard(this, getBaseExprChild())) {
84+
return "(" + getBaseExprChild().toSourceString() + ")" + getSourceStringSuffix();
85+
}
8386
return getBaseExprChild().toSourceString() + getSourceStringSuffix();
8487
}
8588
}

0 commit comments

Comments
 (0)