Package com.google.template.soy.exprtree.OperatorNodes

Examples of com.google.template.soy.exprtree.OperatorNodes.NullCoalescingOpNode


    OrOpNode orOp = (OrOpNode) expr.getChild(0);
    assertEquals("$a", orOp.getChild(0).toSourceString());
    assertEquals(true, ((BooleanNode) orOp.getChild(1)).getValue());

    expr = (new ExpressionParser("$a ?: $b ?: $c")).parseExpression();
    NullCoalescingOpNode nullCoalOp0 = (NullCoalescingOpNode) expr.getChild(0);
    assertEquals("$a", nullCoalOp0.getChild(0).toSourceString());
    NullCoalescingOpNode nullCoalOp1 = (NullCoalescingOpNode) nullCoalOp0.getChild(1);
    assertEquals("$b", nullCoalOp1.getChild(0).toSourceString());
    assertEquals("$c", nullCoalOp1.getChild(1).toSourceString());

    expr = (new ExpressionParser("$a?:$b==null?0*1:0x1")).parseExpression();
    NullCoalescingOpNode nullCoalOp = (NullCoalescingOpNode) expr.getChild(0);
    assertEquals("$a", nullCoalOp.getChild(0).toSourceString());
    ConditionalOpNode condOp = (ConditionalOpNode) nullCoalOp.getChild(1);
    assertTrue(condOp.getChild(0) instanceof EqualOpNode);
    assertTrue(condOp.getChild(1) instanceof TimesOpNode);
    assertTrue(condOp.getChild(2) instanceof IntegerNode);
  }
View Full Code Here

TOP

Related Classes of com.google.template.soy.exprtree.OperatorNodes.NullCoalescingOpNode

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.