Examples of toSourceString()


Examples of com.google.template.soy.exprtree.DataRefAccessNode.toSourceString()

          if (value == null || value instanceof UndefinedData || value instanceof NullData) {
            return NullData.INSTANCE;
          } else {
            throw new RenderException(
                "While evaluating \"" + node.toSourceString() + "\", encountered non-collection" +
                " just before accessing \"" + accessNode.toSourceString() + "\".");
          }
        } else {
          // This behavior is not ideal, but needed for compatibility with existing code.
          return UndefinedData.INSTANCE;
          // TODO: If feasible, find and fix existing instances, then enable this exception.
View Full Code Here

Examples of com.google.template.soy.exprtree.DataRefAccessNode.toSourceString()

        value = ((CollectionData) value).getSingle(key);
      } else {
        if (! (value instanceof SoyListData)) {
          throw new RenderException(
              "While evaluating \"" + node.toSourceString() + "\", encountered non-list" +
              " just before accessing \"" + accessNode.toSourceString() + "\".");
        }
        value = ((SoyListData) value).get(index);
      }
    }
View Full Code Here

Examples of com.google.template.soy.exprtree.DataRefNode.toSourceString()

    access1 = (DataRefAccessExprNode) dataRef.getChild(1);
    assertFalse(access1.isNullSafe());
    DataRefNode childDataRef = (DataRefNode) access1.getChild(0);
    assertTrue(childDataRef.isIjDataRef());
    assertFalse(childDataRef.isNullSafeIjDataRef());
    assertEquals("$ij.foo", childDataRef.toSourceString());
  }


  public void testParseGlobal() throws Exception {
View Full Code Here

Examples of com.google.template.soy.exprtree.ExprNode.toSourceString()

   */
  private void assertRewrite(String origSrc, String expectedRewrittenSrc) throws Exception {

    ExprNode expr = (new ExpressionParser(origSrc)).parseExpression();
    (new RewriteNullCoalescingOpInExprVisitor()).exec(expr);
    String rewrittenSrc = expr.toSourceString();
    assertEquals(expectedRewrittenSrc, rewrittenSrc);
  }

}
View Full Code Here

Examples of com.google.template.soy.exprtree.GlobalNode.toSourceString()

  public void testParseGlobal() throws Exception {

    GlobalNode global = (new ExpressionParser("MOO_2")).parseGlobal().getChild(0);
    assertEquals("MOO_2", global.getName());
    assertEquals("MOO_2", global.toSourceString());

    global = (new ExpressionParser("aaa.BBB")).parseGlobal().getChild(0);
    assertEquals("aaa.BBB", global.getName());
    assertEquals("aaa.BBB", global.toSourceString());
  }
View Full Code Here

Examples of com.google.template.soy.exprtree.GlobalNode.toSourceString()

    assertEquals("MOO_2", global.getName());
    assertEquals("MOO_2", global.toSourceString());

    global = (new ExpressionParser("aaa.BBB")).parseGlobal().getChild(0);
    assertEquals("aaa.BBB", global.getName());
    assertEquals("aaa.BBB", global.toSourceString());
  }


  public void testParsePrimitives() throws Exception {
View Full Code Here

Examples of com.google.template.soy.exprtree.OperatorNodes.ConditionalOpNode.toSourceString()

    n2.addChild(x);
    // Children of n3.
    n3.addChild(x);
    n3.addChild(x);

    assertEquals("not $x ? $x != $x : $x * $x", n0.toSourceString());
  }

}
View Full Code Here

Examples of com.google.template.soy.exprtree.VarNode.toSourceString()

  public void testParseVariable() throws Exception {

    VarNode var = (new ExpressionParser("$boo")).parseVariable().getChild(0);
    assertEquals("boo", var.getName());
    assertEquals("$boo", var.toSourceString());
  }


  public void testParseDataReference() throws Exception {
View Full Code Here

Examples of com.google.template.soy.soytree.ForeachNonemptyNode.toSourceString()

          Context elseContext = infer(neNode, afterBody);
          Context combined = Context.union(elseContext, afterBody);
          if (combined.isErrorContext()) {
            throw SoyAutoescapeException.createWithNode(
                "{foreach} body does not end in the same context after repeated entries : " +
                    neNode.toSourceString(),
                neNode);
          }
          afterBody = combined;
        }
        Context ifemptyContext;
View Full Code Here

Examples of com.google.template.soy.soytree.IfNode.toSourceString()

    IfCondNode in1icn1 = (IfCondNode) in1.getChild(1);
    assertEquals("$foo.goo > 2", in1icn1.getExprText());
    assertTrue(in1icn1.getExprUnion().getExpr().getChild(0) instanceof GreaterThanOpNode);
    assertEquals("", ((IfElseNode) in1.getChild(2)).getCommandText());
    assertEquals("{if $boo}Blah{elseif $foo.goo > 2}{$moo}{else}Blah {$moo}{/if}",
                 in1.toSourceString());
  }


  public void testParseSwitchStmt() throws Exception {
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.