Package com.google.dart.engine.ast

Examples of com.google.dart.engine.ast.Expression


   * @see HintCode#TYPE_CHECK_IS_NULL
   * @see HintCode#UNNECESSARY_TYPE_CHECK_TRUE
   * @see HintCode#UNNECESSARY_TYPE_CHECK_FALSE
   */
  private boolean checkAllTypeChecks(IsExpression node) {
    Expression expression = node.getExpression();
    TypeName typeName = node.getType();
    Type lhsType = expression.getStaticType();
    Type rhsType = typeName.getType();
    if (lhsType == null || rhsType == null) {
      return false;
    }
    String rhsNameStr = typeName.getName().getName();
View Full Code Here


   * @param node the as expression to check
   * @return {@code true} if and only if a hint code is generated on the passed node
   * @see HintCode#UNNECESSARY_CAST
   */
  private boolean checkForUnnecessaryCast(AsExpression node) {
    Expression expression = node.getExpression();
    TypeName typeName = node.getType();
    Type lhsType = expression.getStaticType();
    Type rhsType = typeName.getType();
    // TODO(jwren) After dartbug.com/13732, revisit this, we should be able to remove the
    // !(x instanceof TypeParameterType) checks.
    if (lhsType != null && rhsType != null && !lhsType.isDynamic() && !rhsType.isDynamic()
        && !(lhsType instanceof TypeParameterType) && !(rhsType instanceof TypeParameterType)
View Full Code Here

    SimpleStringLiteral nameLiteral = null;
    ArgumentList argsNode = annotation.getArguments();
    if (argsNode != null) {
      NodeList<Expression> args = argsNode.getArguments();
      if (args.size() == 1) {
        Expression arg = args.get(0);
        if (arg instanceof SimpleStringLiteral) {
          nameLiteral = (SimpleStringLiteral) arg;
        }
      }
    }
View Full Code Here

  /**
   * @return the offset of the value of the named argument.
   */
  private int getStringArgumentOffset(String name) {
    Expression argument = getArgument(name);
    return ((SimpleStringLiteral) argument).getValueOffset();
  }
View Full Code Here

  /**
   * @return the {@link SimpleStringLiteral} of the named argument.
   */
  private SimpleStringLiteral getStringLiteral(String name) {
    Expression argument = getArgument(name);
    return (SimpleStringLiteral) argument;
  }
View Full Code Here

  /**
   * Checks if {@link #namedArguments} has string value for the argument with the given name.
   */
  private boolean hasStringArgument(String name) {
    Expression argument = getArgument(name);
    return argument instanceof SimpleStringLiteral;
  }
View Full Code Here

  /**
   * Parses {@link AngularPropertyElement}s from {@link #annotation}.
   */
  private void parseComponentProperties_fromMap(List<AngularPropertyElement> properties) {
    Expression mapExpression = getArgument("map");
    // may be not properties
    if (mapExpression == null) {
      return;
    }
    // prepare map literal
    if (!(mapExpression instanceof MapLiteral)) {
      reportErrorForNode(AngularCode.INVALID_PROPERTY_MAP, mapExpression);
      return;
    }
    MapLiteral mapLiteral = (MapLiteral) mapExpression;
    // analyze map entries
    for (MapLiteralEntry entry : mapLiteral.getEntries()) {
      // prepare property name
      Expression nameExpression = entry.getKey();
      if (!(nameExpression instanceof SimpleStringLiteral)) {
        reportErrorForNode(AngularCode.INVALID_PROPERTY_NAME, nameExpression);
        continue;
      }
      SimpleStringLiteral nameLiteral = (SimpleStringLiteral) nameExpression;
      String name = nameLiteral.getValue();
      int nameOffset = nameLiteral.getValueOffset();
      // prepare field specification
      Expression specExpression = entry.getValue();
      if (!(specExpression instanceof SimpleStringLiteral)) {
        reportErrorForNode(AngularCode.INVALID_PROPERTY_SPEC, specExpression);
        continue;
      }
      SimpleStringLiteral specLiteral = (SimpleStringLiteral) specExpression;
View Full Code Here

      }

      private SimpleStringLiteral getNameNode(Expression node) {
        if (node instanceof IndexExpression) {
          IndexExpression indexExpression = (IndexExpression) node;
          Expression target = indexExpression.getTarget();
          Expression index = indexExpression.getIndex();
          if (index instanceof SimpleStringLiteral && isContext(target)) {
            return (SimpleStringLiteral) index;
          }
        }
        return null;
View Full Code Here

        List<Expression> arguments = node.getArgumentList().getArguments();
        if (arguments.size() != 1) {
          return;
        }
        // String literal
        Expression argument = arguments.get(0);
        if (!(argument instanceof SimpleStringLiteral)) {
          return;
        }
        SimpleStringLiteral literal = (SimpleStringLiteral) argument;
        // just view('template')
View Full Code Here

  private void reportErrorForAnnotation(ErrorCode errorCode, Object... arguments) {
    reportErrorForNode(errorCode, annotation, arguments);
  }

  private void reportErrorForArgument(String argumentName, ErrorCode errorCode, Object... arguments) {
    Expression argument = getArgument(argumentName);
    reportErrorForNode(errorCode, argument, arguments);
  }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.ast.Expression

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.