Package com.google.template.soy.exprtree

Examples of com.google.template.soy.exprtree.DataRefAccessExprNode


    assertEquals("boo", dataRef.getFirstKey());
    assertEquals(2, dataRef.numChildren());
    DataRefAccessIndexNode access0 = (DataRefAccessIndexNode) dataRef.getChild(0);
    assertFalse(access0.isNullSafe());
    assertEquals(0, access0.getIndex());
    DataRefAccessExprNode access1 = (DataRefAccessExprNode) dataRef.getChild(1);
    assertFalse(access1.isNullSafe());
    assertEquals("$foo", access1.getChild(0).toSourceString());

    dataRef = (new ExpressionParser("$boo?.0?[$foo]")).parseDataReference().getChild(0);
    assertFalse(dataRef.isIjDataRef());
    assertFalse(dataRef.isNullSafeIjDataRef());
    assertEquals("boo", dataRef.getFirstKey());
    assertEquals(2, dataRef.numChildren());
    access0 = (DataRefAccessIndexNode) dataRef.getChild(0);
    assertTrue(access0.isNullSafe());
    assertEquals(0, access0.getIndex());
    access1 = (DataRefAccessExprNode) dataRef.getChild(1);
    assertTrue(access1.isNullSafe());
    assertEquals("$foo", access1.getChild(0).toSourceString());

    dataRef = (new ExpressionParser("$ij?.boo?.0[$ij.foo]")).parseDataReference().getChild(0);
    assertTrue(dataRef.isIjDataRef());
    assertTrue(dataRef.isNullSafeIjDataRef());
    assertEquals("boo", dataRef.getFirstKey());
    assertEquals(2, dataRef.numChildren());
    access0 = (DataRefAccessIndexNode) dataRef.getChild(0);
    assertTrue(access0.isNullSafe());
    assertEquals(0, access0.getIndex());
    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());
  }
View Full Code Here

TOP

Related Classes of com.google.template.soy.exprtree.DataRefAccessExprNode

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.