Package com.google.template.soy.soytree

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


      String key = child.getKey();
      paramsObjSb.append('\"').append(key).append("\", ");

      if (child instanceof CallParamValueNode) {
        CallParamValueNode cpvn = (CallParamValueNode) child;
        JavaExpr valueJavaExpr = ttjev.exec(cpvn.getValueExprUnion().getExpr());
        paramsObjSb.append(valueJavaExpr.getText());

      } else {
        CallParamContentNode cpcn = (CallParamContentNode) child;
View Full Code Here


    // If not, then stop (i.e. return) because we cannot pass data="all" instead.
    for (CallParamNode param : node.getChildren()) {
      if (! (param instanceof CallParamValueNode)) {
        return;
      }
      CallParamValueNode valueParam = (CallParamValueNode) param;
      if (! ("$" + valueParam.getKey()).equals(valueParam.getValueExprText())) {
        return;
      }
      ExprRootNode<?> valueExprRoot = ((CallParamValueNode) param).getValueExprUnion().getExpr();
      if (valueExprRoot == null) {
        return;
View Full Code Here

      String key = child.getKey();
      paramsObjSb.append(key).append(": ");

      if (child instanceof CallParamValueNode) {
        CallParamValueNode cpvn = (CallParamValueNode) child;
        JsExpr valueJsExpr = jsExprTranslator.translateToJsExpr(
            cpvn.getValueExprUnion().getExpr(), cpvn.getValueExprText(), localVarTranslations);
        paramsObjSb.append(valueJsExpr.getText());

      } else {
        CallParamContentNode cpcn = (CallParamContentNode) child;
        JsExpr valueJsExpr;
View Full Code Here

    assertTrue(cn2.getDataExpr().getChild(0) != null);
    assertEquals("$animals", cn2.getDataExpr().toSourceString());
    assertEquals(3, cn2.numChildren());

    {
      final CallParamValueNode cn2cpvn0 = (CallParamValueNode) cn2.getChild(0);
      assertEquals("yoo", cn2cpvn0.getKey());
      assertEquals("round($too)", cn2cpvn0.getValueExprText());
      assertTrue(cn2cpvn0.getValueExprUnion().getExpr().getChild(0) instanceof FunctionNode);
    }

    {
      final CallParamContentNode cn2cpcn1 = (CallParamContentNode) cn2.getChild(1);
      assertEquals("woo", cn2cpcn1.getKey());
      assertNull(cn2cpcn1.getContentKind());
      assertEquals("poo", ((RawTextNode) cn2cpcn1.getChild(0)).getRawText());
    }

    {
      final CallParamContentNode cn2cpcn2 = (CallParamContentNode) cn2.getChild(2);
      assertEquals("doo", cn2cpcn2.getKey());
      assertNotNull(cn2cpcn2.getContentKind());
      assertEquals(ContentKind.HTML, cn2cpcn2.getContentKind());
      assertEquals("doopoo", ((RawTextNode) cn2cpcn2.getChild(0)).getRawText());
    }

    CallBasicNode cn3 = (CallBasicNode) nodes.get(3);
    assertEquals(SyntaxVersion.V2, cn3.getSyntaxVersion());
    assertEquals(null, cn3.getCalleeName());
    assertEquals(".booTemplate_", cn3.getSrcCalleeName());
    assertEquals(false, cn3.isPassingData());
    assertEquals(false, cn3.isPassingAllData());
    assertEquals(null, cn3.getDataExpr());
    assertEquals("XXX", cn3.genBasePlaceholderName());
    assertEquals(0, cn3.numChildren());

    CallBasicNode cn4 = (CallBasicNode) nodes.get(4);
    assertEquals(SyntaxVersion.V2, cn4.getSyntaxVersion());
    assertEquals(null, cn4.getCalleeName());
    assertEquals(".zooTemplate", cn4.getSrcCalleeName());
    assertEquals(true, cn4.isPassingData());
    assertEquals(false, cn4.isPassingAllData());
    assertTrue(cn4.getDataExpr().getChild(0) != null);
    assertEquals("$animals", cn4.getDataExpr().toSourceString());
    assertEquals(4, cn4.numChildren());

    {
      final CallParamValueNode cn4cpvn0 = (CallParamValueNode) cn4.getChild(0);
      assertEquals("yoo", cn4cpvn0.getKey());
      assertEquals("round($too)", cn4cpvn0.getValueExprText());
      assertTrue(cn4cpvn0.getValueExprUnion().getExpr().getChild(0) instanceof FunctionNode);
    }

    {
      final CallParamContentNode cn4cpcn1 = (CallParamContentNode) cn4.getChild(1);
      assertEquals("woo", cn4cpcn1.getKey());
      assertNull(cn4cpcn1.getContentKind());
      assertEquals("poo", ((RawTextNode) cn4cpcn1.getChild(0)).getRawText());
    }

    {
      final CallParamValueNode cn4cpvn2 = (CallParamValueNode) cn4.getChild(2);
      assertEquals("zoo", cn4cpvn2.getKey());
      assertEquals("0", cn4cpvn2.getValueExprText());
    }

    {
      final CallParamContentNode cn4cpcn3 = (CallParamContentNode) cn4.getChild(3);
      assertEquals("doo", cn4cpcn3.getKey());
View Full Code Here

    assertEquals(false, cn2.isPassingAllData());
    assertTrue(cn2.getDataExpr().getChild(0) != null);
    assertEquals("$animals", cn2.getDataExpr().toSourceString());
    assertEquals(2, cn2.numChildren());

    CallParamValueNode cn2cpvn0 = (CallParamValueNode) cn2.getChild(0);
    assertEquals("yoo", cn2cpvn0.getKey());
    assertEquals("round($too)", cn2cpvn0.getValueExprText());
    assertTrue(cn2cpvn0.getValueExprUnion().getExpr().getChild(0) instanceof FunctionNode);

    CallParamContentNode cn2cpcn1 = (CallParamContentNode) cn2.getChild(1);
    assertEquals("woo", cn2cpcn1.getKey());
    assertEquals("poo", ((RawTextNode) cn2cpcn1.getChild(0)).getRawText());
  }
View Full Code Here

    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.
View Full Code Here

TOP

Related Classes of com.google.template.soy.soytree.CallParamValueNode

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.