Package com.google.dart.engine.ast

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


    Element staticElement = propertyName.getStaticElement();
    Type staticType = dynamicType;
    if (staticElement instanceof MethodElement) {
      staticType = ((MethodElement) staticElement).getType();
    } else if (staticElement instanceof PropertyAccessorElement) {
      Expression realTarget = node.getRealTarget();
      staticType = getTypeOfProperty((PropertyAccessorElement) staticElement, realTarget != null
          ? getStaticType(realTarget) : null);
    } else {
      // TODO(brianwilkerson) Report this internal error.
    }
    recordStaticType(propertyName, staticType);
    recordStaticType(node, staticType);

    Element propagatedElement = propertyName.getPropagatedElement();
    Type propagatedType = overrideManager.getType(propagatedElement);
    if (propagatedElement instanceof MethodElement) {
      propagatedType = ((MethodElement) propagatedElement).getType();
    } else if (propagatedElement instanceof PropertyAccessorElement) {
      Expression realTarget = node.getRealTarget();
      propagatedType = getTypeOfProperty(
          (PropertyAccessorElement) propagatedElement,
          realTarget != null ? realTarget.getBestType() : null);
    } else {
      // TODO(brianwilkerson) Report this internal error.
    }
    if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
      recordPropagatedType(propertyName, propagatedType);
View Full Code Here


    return null;
  }

  @Override
  public Void visitVariableDeclaration(VariableDeclaration node) {
    Expression initializer = node.getInitializer();
    if (initializer != null) {
      Type rightType = initializer.getBestType();
      SimpleIdentifier name = node.getName();
      recordPropagatedType(name, rightType);
      VariableElement element = (VariableElement) name.getStaticElement();
      if (element != null) {
        resolver.overrideVariable(element, rightType, true);
View Full Code Here

        @Override
        public Void visitReturnStatement(ReturnStatement node) {
          // prepare this 'return' type
          Type type;
          Expression expression = node.getExpression();
          if (expression != null) {
            type = expression.getBestType();
          } else {
            type = BottomTypeImpl.getInstance();
          }
          // merge types
          if (result[0] == null) {
View Full Code Here

   * @return the string specified by the first argument in the argument list
   */
  private String getFirstArgumentAsString(ArgumentList argumentList) {
    NodeList<Expression> arguments = argumentList.getArguments();
    if (arguments.size() > 0) {
      Expression argument = arguments.get(0);
      if (argument instanceof SimpleStringLiteral) {
        return ((SimpleStringLiteral) argument).getValue();
      }
    }
    return null;
View Full Code Here

  @Override
  public Void visitDefaultFormalParameter(DefaultFormalParameter node) {
    SimpleIdentifier parameterName = node.getParameter().getIdentifier();
    ParameterElement element = getElementForParameter(node, parameterName);
    Expression defaultValue = node.getDefaultValue();
    if (defaultValue != null) {
      ExecutableElement outerExecutable = enclosingExecutable;
      try {
        if (element == null) {
          // TODO(brianwilkerson) Report this internal error.
        } else {
          enclosingExecutable = element.getInitializer();
        }
        defaultValue.accept(this);
      } finally {
        enclosingExecutable = outerExecutable;
      }
    }
    ParameterElement outerParameter = enclosingParameter;
View Full Code Here

      element = findIdentifier(enclosingClass.getFields(), variableName);
    }
    if (element == null && enclosingUnit != null) {
      element = findIdentifier(enclosingUnit.getTopLevelVariables(), variableName);
    }
    Expression initializer = node.getInitializer();
    if (initializer != null) {
      ExecutableElement outerExecutable = enclosingExecutable;
      try {
        if (element == null) {
          // TODO(brianwilkerson) Report this internal error.
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.