Package com.google.dart.engine.element

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


      if (!baseType.equals(substitutedType)) {
        return true;
      }
      // If this property accessor is based on a field, that field might have a propagated type.
      // In which case we need to check whether the propagated type of the field needs substitution.
      PropertyInducingElement field = baseAccessor.getVariable();
      if (!field.isSynthetic()) {
        Type baseFieldType = field.getPropagatedType();
        if (baseFieldType != null) {
          Type substitutedFieldType = baseFieldType.substitute(argumentTypes, parameterTypes);
          if (!baseFieldType.equals(substitutedFieldType)) {
            return true;
          }
View Full Code Here


    return getBaseElement().getEnclosingElement();
  }

  @Override
  public PropertyInducingElement getVariable() {
    PropertyInducingElement variable = getBaseElement().getVariable();
    if (variable instanceof FieldElement) {
      return FieldMember.from(((FieldElement) variable), getDefiningType());
    }
    return variable;
  }
View Full Code Here

      PropertyAccess propertyAccess = (PropertyAccess) expression;
      element = propertyAccess.getPropertyName().getStaticElement();
    }
    if (element instanceof PropertyAccessorElement) {
      PropertyAccessorElement pae = (PropertyAccessorElement) element;
      PropertyInducingElement variable = pae.getVariable();
      return variable != null && variable.isConst();
    }
    return false;
  }
View Full Code Here

              prefixElement.getName());
        }
        return null;
      }
      if (element instanceof PropertyAccessorElement && identifier.inSetterContext()) {
        PropertyInducingElement variable = ((PropertyAccessorElement) element).getVariable();
        if (variable != null) {
          PropertyAccessorElement setter = variable.getSetter();
          if (setter != null) {
            element = setter;
          }
        }
      }
View Full Code Here

   * @return the element to which the identifier could be resolved
   */
  private Element resolveSimpleIdentifier(SimpleIdentifier node) {
    Element element = resolver.getNameScope().lookup(node, definingLibrary);
    if (element instanceof PropertyAccessorElement && node.inSetterContext()) {
      PropertyInducingElement variable = ((PropertyAccessorElement) element).getVariable();
      if (variable != null) {
        PropertyAccessorElement setter = variable.getSetter();
        if (setter == null) {
          //
          // Check to see whether there might be a locally defined getter and an inherited setter.
          //
          ClassElement enclosingClass = resolver.getEnclosingClass();
View Full Code Here

    // The first check, that [! (C << P)], covers the case where [P] and [C] are unrelated types;
    // This case is not addressed in the spec for static types.
    if (currentType == null || allowPrecisionLoss || !currentType.isMoreSpecificThan(potentialType)
        || potentialType.isMoreSpecificThan(currentType)) {
      if (element instanceof PropertyInducingElement) {
        PropertyInducingElement variable = (PropertyInducingElement) element;
        if (!variable.isConst() && !variable.isFinal()) {
          return;
        }
        ((PropertyInducingElementImpl) variable).setPropagatedType(potentialType);
      }
      overrideManager.setType(element, potentialType);
View Full Code Here

    }
    Element element = node.getName().getStaticElement();
    if (element instanceof VariableElement) {
      ((VariableElementImpl) element).setType(declaredType);
      if (element instanceof PropertyInducingElement) {
        PropertyInducingElement variableElement = (PropertyInducingElement) element;
        PropertyAccessorElementImpl getter = (PropertyAccessorElementImpl) variableElement.getGetter();
        getter.setReturnType(declaredType);
        FunctionTypeImpl getterType = new FunctionTypeImpl(getter);
        ClassElement definingClass = element.getAncestor(ClassElement.class);
        if (definingClass != null) {
          getterType.setTypeArguments(definingClass.getType().getTypeArguments());
        }
        getter.setType(getterType);

        PropertyAccessorElementImpl setter = (PropertyAccessorElementImpl) variableElement.getSetter();
        if (setter != null) {
          ParameterElement[] parameters = setter.getParameters();
          if (parameters.length > 0) {
            ((ParameterElementImpl) parameters[0]).setType(declaredType);
          }
View Full Code Here

   */
  private Type getPropertyPropagatedType(Element element, Type currentType) {
    if (element instanceof PropertyAccessorElement) {
      PropertyAccessorElement accessor = (PropertyAccessorElement) element;
      if (accessor.isGetter()) {
        PropertyInducingElement variable = accessor.getVariable();
        Type propagatedType = variable.getPropagatedType();
        if (currentType == null || propagatedType != null
            && propagatedType.isMoreSpecificThan(currentType)) {
          return propagatedType;
        }
      }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.element.PropertyInducingElement

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.