Examples of VariableElement


Examples of com.google.dart.engine.element.VariableElement

    if (!accessorElement.isSynthetic()) {
      resolver.reportErrorForNode(CompileTimeErrorCode.INVALID_ANNOTATION, annotation);
      return;
    }
    // variable should be constant
    VariableElement variableElement = accessorElement.getVariable();
    if (!variableElement.isConst()) {
      resolver.reportErrorForNode(CompileTimeErrorCode.INVALID_ANNOTATION, annotation);
    }
    // OK
    return;
  }
View Full Code Here

Examples of com.google.dart.engine.element.VariableElement

   * @param potentialType the potential type of the elements
   * @param allowPrecisionLoss see @{code overrideVariable} docs
   */
  protected void overrideExpression(Expression expression, Type potentialType,
      boolean allowPrecisionLoss) {
    VariableElement element = getOverridableStaticElement(expression);
    if (element != null) {
      overrideVariable(element, potentialType, allowPrecisionLoss);
    }
    element = getOverridablePropagatedElement(expression);
    if (element != null) {
View Full Code Here

Examples of com.google.dart.engine.element.VariableElement

   * @param expression the expression used to access the static element whose types might be
   *          promoted
   * @param potentialType the potential type of the elements
   */
  private void promote(Expression expression, Type potentialType) {
    VariableElement element = getPromotionStaticElement(expression);
    if (element != null) {
      // may be mutated somewhere in closure
      if (((VariableElementImpl) element).isPotentiallyMutatedInClosure()) {
        return;
      }
View Full Code Here

Examples of com.google.dart.engine.element.VariableElement

    return null;
  }

  @Override
  public Void visitDeclaredIdentifier(DeclaredIdentifier node) {
    VariableElement element = node.getElement();
    if (element != null) {
      nameScope.define(element);
    }
    super.visitDeclaredIdentifier(node);
    return null;
View Full Code Here

Examples of com.google.dart.engine.element.VariableElement

  @Override
  public Void visitVariableDeclaration(VariableDeclaration node) {
    super.visitVariableDeclaration(node);
    if (!(node.getParent().getParent() instanceof TopLevelVariableDeclaration)
        && !(node.getParent().getParent() instanceof FieldDeclaration)) {
      VariableElement element = node.getElement();
      if (element != null) {
        nameScope.define(element);
      }
    }
    return null;
View Full Code Here

Examples of com.google.dart.engine.element.VariableElement

    } else if (element instanceof ExecutableElement) {
      staticType = ((ExecutableElement) element).getType();
    } else if (element instanceof TypeParameterElement) {
      staticType = typeProvider.getTypeType();
    } else if (element instanceof VariableElement) {
      VariableElement variable = (VariableElement) element;
      staticType = promoteManager.getStaticType(variable);
    } else if (element instanceof PrefixElement) {
      return null;
    } else {
      staticType = dynamicType;
View Full Code Here

Examples of com.google.dart.engine.element.VariableElement

    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);
      }
    }
    return null;
View Full Code Here

Examples of com.google.dart.engine.element.VariableElement

      if (type != null) {
        // TODO(brianwilkerson) Figure out the conditions under which the type is null.
        return type.getReturnType();
      }
    } else if (element instanceof VariableElement) {
      VariableElement variable = (VariableElement) element;
      Type variableType = promoteManager.getStaticType(variable);
      if (variableType instanceof FunctionType) {
        return ((FunctionType) variableType).getReturnType();
      }
    }
View Full Code Here

Examples of com.google.dart.engine.element.VariableElement

    return super.visitTypeParameter(node);
  }

  @Override
  public Void visitVariableDeclaration(VariableDeclaration node) {
    VariableElement element = null;
    SimpleIdentifier variableName = node.getName();
    if (enclosingExecutable != null) {
      element = findIdentifier(enclosingExecutable.getLocalVariables(), variableName);
    }
    if (element == null && enclosingClass != null) {
      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.
        } else {
          enclosingExecutable = element.getInitializer();
        }
        return super.visitVariableDeclaration(node);
      } finally {
        enclosingExecutable = outerExecutable;
      }
View Full Code Here

Examples of javax.lang.model.element.VariableElement

     * 引数の名前を返す。
     * @param index 引数の番号 (0起算)
     * @return 引数の名前
     */
    public SimpleName getParameterName(int index) {
        VariableElement parameter = element.getParameters().get(index);
        return factory.newSimpleName(parameter.getSimpleName().toString());
    }
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.