Examples of CallNode


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


  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

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

        "    {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

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

      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

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

        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

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

      } 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

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

    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

Examples of org.joni.ast.CallNode

            } while ((can = can.cdr) != null);
            break;

        case NodeType.CALL:
            if (Config.USE_SUBEXP_CALL) {
                CallNode cn = (CallNode)node;
                if (cn.isRecursion()) {
                    return TargetInfo.IS_EMPTY_REC; /* tiny version */
                } else {
                    info = quantifiersMemoryInfo(cn.target);
                }
            } // USE_SUBEXP_CALL
View Full Code Here

Examples of org.joni.ast.CallNode

            }
            break;

        case NodeType.CALL:
            if (Config.USE_SUBEXP_CALL) {
                CallNode cn = (CallNode)node;
                if (cn.isRecursion()) {
                    EncloseNode en = (EncloseNode)cn.target;
                    if (en.isMinFixed()) min = en.minLength;
                } else {
                    min = getMinMatchLength(cn.target);
                }
View Full Code Here

Examples of org.joni.ast.CallNode

            }
            break;

        case NodeType.CALL:
            if (Config.USE_SUBEXP_CALL) {
                CallNode cn = (CallNode)node;
                if (!cn.isRecursion()) {
                    max = getMaxMatchLength(cn.target);
                } else {
                    max = MinMaxLen.INFINITE_DISTANCE;
                }
            } // USE_SUBEXP_CALL
View Full Code Here

Examples of org.joni.ast.CallNode

            }
            break;

        case NodeType.CALL:
            if (Config.USE_SUBEXP_CALL) {
                CallNode cn = (CallNode)node;
                if (!cn.isRecursion()) {
                    len = getCharLengthTree(cn.target, level);
                } else {
                    returnCode = GET_CHAR_LEN_VARLEN;
                }
            } // USE_SUBEXP_CALL
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.