Properly copy over references to variable declarations made by retaining the same copy state.
GITHUB_BREAKING_CHANGES=n/a
@@ -380,10 +380,11 @@ final class SoyElementCompositionPass implements CompilerFileSetPass {
errorReporter);
callNode.addChild(callParamContent);
SoyNode.StandaloneNode next = (SoyNode.StandaloneNode) SoyTreeUtils.nextSibling(nextOpenTag);
+ CopyState copyState = new CopyState();
while (next != closeTag) {
SoyNode.StandaloneNode sibling = (SoyNode.StandaloneNode) SoyTreeUtils.nextSibling(next);
next.getParent().removeChild(next);
- callParamContent.addChild(next);
+ callParamContent.addChild(next.copy(copyState));
next = sibling;
}
nextOpenTag.getParent().removeChild(nextOpenTag);
@@ -458,8 +459,9 @@ final class SoyElementCompositionPass implements CompilerFileSetPass {
unknown,
unknown),
errorReporter);
+ CopyState copyState = new CopyState();
for (StandaloneNode node : attrValue.getChildren()) {
- contentNode.addChild(node.copy(new CopyState()));
+ contentNode.addChild(node.copy(copyState));
}
return contentNode;
}
@@ -492,8 +494,9 @@ final class SoyElementCompositionPass implements CompilerFileSetPass {
nodeIdGen.genId(), unknown, unknown, "if", condition.get().copy(new CopyState()));
ifNode.addChild(ifCondNode);
ifCondNode.getExpr().setType(condition.get().getType());
+ CopyState copyState = new CopyState();
for (StandaloneNode node : attrValue.getChildren()) {
- ifCondNode.addChild(node.copy(new CopyState()));
+ ifCondNode.addChild(node.copy(copyState));
}
VarRefNode varRef =
new VarRefNode("$" + letContentNode.getVar().name(), unknown, letContentNode.getVar());
