Package com.google.template.soy.soytree

Examples of com.google.template.soy.soytree.CallNode$CommandTextInfo



  private void testUnchangedCallHelper(String callCode) throws Exception {

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyCode(callCode);
    CallNode callNodeBeforePass = (CallNode) SharedTestUtils.getNode(soyTree, 0);
    callNodeBeforePass.setEscapingDirectiveNames(ImmutableList.of("|escapeHtml"));
    (new ChangeCallsToPassAllDataVisitor()).exec(soyTree);
    CallNode callNodeAfterPass = (CallNode) SharedTestUtils.getNode(soyTree, 0);
    assertEquals(callNodeBeforePass, callNodeAfterPass);
    assertEquals("Escaping directives should be preserved",
        ImmutableList.of("|escapeHtml"),
        callNodeAfterPass.getEscapingDirectiveNames());
  }
View Full Code Here


        "    {param xxx: $xxx /}\n" +
        "  {/call}\n" +
        "{/foreach}";
    SoyFileSetNode soyTree = SharedTestUtils.parseSoyCode(soyCode);

    CallNode callNodeOutsideLoopBeforePass = (CallNode) SharedTestUtils.getNode(soyTree, 0);
    CallNode callNodeInsideLoopBeforePass = (CallNode) SharedTestUtils.getNode(soyTree, 1, 0, 0);
    (new ChangeCallsToPassAllDataVisitor()).exec(soyTree);
    CallNode callNodeOutsideLoopAfterPass = (CallNode) SharedTestUtils.getNode(soyTree, 0);
    CallNode callNodeInsideLoopAfterPass = (CallNode) SharedTestUtils.getNode(soyTree, 1, 0, 0);

    assertNotSame(callNodeOutsideLoopBeforePass, callNodeOutsideLoopAfterPass);
    assertSame(callNodeInsideLoopBeforePass, callNodeInsideLoopAfterPass);
  }
View Full Code Here

      String derivedCalleeName = inferences.getDerivedCalleeNameForCallId(callNode.getId());
      if (derivedCalleeName != null) {
        // Creates a new call node, but with a different target name.
        // TODO: Create a CallNode.withNewName() convenience method.
        CallNode newCallNode;
        if (callNode instanceof CallBasicNode) {
          // For simplicity, use the full callee name as the source callee name.
          newCallNode = new CallBasicNode(
              callNode.getId(), derivedCalleeName, derivedCalleeName, false,
              callNode.isPassingData(), callNode.isPassingAllData(), callNode.getDataExpr(),
              callNode.getUserSuppliedPlaceholderName(), callNode.getSyntaxVersion(),
              callNode.getEscapingDirectiveNames());
        } else {
          CallDelegateNode callNodeCast = (CallDelegateNode) callNode;
          newCallNode = new CallDelegateNode(
              callNode.getId(), derivedCalleeName, callNodeCast.getDelCalleeVariantExpr(), false,
              callNodeCast.allowsEmptyDefault(), callNode.isPassingData(),
              callNode.isPassingAllData(), callNode.getDataExpr(),
              callNode.getUserSuppliedPlaceholderName(),
              callNode.getEscapingDirectiveNames());
        }
        if (!callNode.getCommandText().equals(newCallNode.getCommandText())) {
          newCallNode.setSourceLocation(callNode.getSourceLocation());
          moveChildrenTo(callNode, newCallNode);
          replaceChild(callNode, newCallNode);
        }
        // Ensure we visit the new node instead of the old one.
        callNode = newCallNode;
View Full Code Here

        return;
      }
    }

    // Change this call to pass data="all" and remove all params. (We reuse the node id.)
    CallNode newCallNode;
    if (node instanceof CallBasicNode) {
      CallBasicNode nodeCast = (CallBasicNode) node;
      newCallNode = new CallBasicNode(
          node.getId(), nodeCast.getCalleeName(), nodeCast.getSrcCalleeName(), false, true,
          true, null, node.getUserSuppliedPlaceholderName(), SyntaxVersion.V2,
View Full Code Here

      } else if (contentNode instanceof CallNode) {
        // If the CallNode has any CallParamContentNode children (i.e. this GoogMsgNode's
        // grandchildren) that are not computable as JS expressions, visit them to generate code
        // to define their respective 'param<n>' variables.
        CallNode callNode = (CallNode) contentNode;
        for (CallParamNode grandchild : callNode.getChildren()) {
          if (grandchild instanceof CallParamContentNode &&
              !isComputableAsJsExprsVisitor.exec(grandchild)) {
            visit(grandchild);
          }
        }
View Full Code Here

    PrintDirectiveNode ghPdn = gh.getChild(0);
    MsgNode msgNode = (MsgNode) foreachNonemptyNode.getChild(2);
    MsgPlaceholderNode iPh = (MsgPlaceholderNode) msgNode.getChild(0);
    PrintNode i = (PrintNode) iPh.getChild(0);
    MsgPlaceholderNode callPh = (MsgPlaceholderNode) msgNode.getChild(1);
    CallNode callNode = (CallNode) callPh.getChild(0);
    CallParamValueNode cpvn = (CallParamValueNode) callNode.getChild(0);
    CallParamContentNode cpcn = (CallParamContentNode) callNode.getChild(1);
    PrintNode n = (PrintNode) cpcn.getChild(0);
    PrintNode fo = (PrintNode) cpcn.getChild(1);

    // Build the nearest-dependee map.
    Map<SoyNode, List<SoyNode>> allDependeesMap = (new BuildAllDependeesMapVisitor()).exec(soyTree);
View Full Code Here

TOP

Related Classes of com.google.template.soy.soytree.CallNode$CommandTextInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.