Examples of numChildren()


Examples of com.adobe.ac.pmd.parser.IParserNode.numChildren()

      super.visitFunction( ast,
                           type );

      final IParserNode paramList = ast.getChild( 2 );

      paramsNb = paramList.numChildren();

      if ( paramsNb > getThreshold() )
      {
         addViolation( paramList );
      }
View Full Code Here

Examples of com.google.gwt.thirdparty.common.css.compiler.ast.CssFunctionArgumentsNode.numChildren()

  private void assertResultIsValid(List<CssValueNode> result, String expectedJavaExpression) {
    assertEquals(1, result.size());
    assertTrue(result.get(0) instanceof CssFunctionNode);

    CssFunctionArgumentsNode arguments = ((CssFunctionNode) result.get(0)).getArguments();
    assertEquals(1, arguments.numChildren());
    assertTrue(arguments.getChildAt(0) instanceof CssJavaExpressionNode);

    CssJavaExpressionNode javaExpressionNode = (CssJavaExpressionNode) arguments.getChildAt(0);
    assertEquals(expectedJavaExpression, javaExpressionNode.getValue());
View Full Code Here

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

    DataRefNode dataRef = (new ExpressionParser("$boo.0[$foo]")).parseDataReference().getChild(0);
    assertFalse(dataRef.isIjDataRef());
    assertFalse(dataRef.isNullSafeIjDataRef());
    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());
View Full Code Here

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

    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());
View Full Code Here

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

    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());
View Full Code Here

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

      }
      DataRefNode loopVariableRef = (DataRefNode) loopVariable;
      if (loopVariableRef.isIjDataRef()) {
        return false;
      }
      if (loopVariableRef.numChildren() != 0) {
        return false;
      }
      String loopVariableName = loopVariableRef.getFirstKey();
      for (ParentSoyNode<?> ancestor = container.getParent(); ancestor != null;
           ancestor = ancestor.getParent()) {
View Full Code Here

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

    ExprNode exprNode = exprRoot.getChild(0);

    if (exprNode instanceof DataRefNode) {
      DataRefNode dataRefNode = (DataRefNode) exprNode;

      if (dataRefNode.numChildren() > 0) {
        ExprNode lastChild = dataRefNode.getChild(dataRefNode.numChildren() - 1);
        // Only handle if last child is a key. Else, fall through.
        if (lastChild instanceof DataRefAccessKeyNode) {
          return BaseUtils.convertToUpperUnderscore(((DataRefAccessKeyNode) lastChild).getKey());
        }
View Full Code Here

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

    if (exprNode instanceof DataRefNode) {
      DataRefNode dataRefNode = (DataRefNode) exprNode;

      if (dataRefNode.numChildren() > 0) {
        ExprNode lastChild = dataRefNode.getChild(dataRefNode.numChildren() - 1);
        // Only handle if last child is a key. Else, fall through.
        if (lastChild instanceof DataRefAccessKeyNode) {
          return BaseUtils.convertToUpperUnderscore(((DataRefAccessKeyNode) lastChild).getKey());
        }
      } else {
View Full Code Here

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

    // Check the validity of the key name.
    DataRefNode dataRef = ExprParseUtils.parseDataRefElseThrowSoySyntaxException(
        "$" + key,
        "Invalid key in 'param' command text \"" + commandText + "\".")
        .getChild(0);
    if (dataRef.numChildren() > 1 || dataRef.isIjDataRef()) {
      throw SoySyntaxException.createWithoutMetaInfo(
          "The key in a 'param' tag must be top level, i.e. not contain multiple keys" +
              " (invalid 'param' command text \"" + commandText + "\").");
    }
View Full Code Here

Examples of com.google.template.soy.exprtree.FunctionNode.numChildren()

  public void testParseFunctionCall() throws Exception {

    ExprRootNode<?> expr = (new ExpressionParser("isFirst($x)")).parseExpression();
    FunctionNode isFirstFn = (FunctionNode) expr.getChild(0);
    assertEquals("isFirst", isFirstFn.getFunctionName());
    assertEquals(1, isFirstFn.numChildren());
    assertEquals("$x", ((DataRefNode) isFirstFn.getChild(0)).toSourceString());

    expr = (new ExpressionParser("round(3.14159, 2)")).parseExpression();
    FunctionNode roundFn = (FunctionNode) expr.getChild(0);
    assertEquals("round", roundFn.getFunctionName());
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.