Package com.google.dart.engine.element

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


      element = propertyAccess.getPropertyName().getStaticElement();
      highlightedNode = propertyAccess.getPropertyName();
    }
    // check if element is assignable
    if (element instanceof PropertyAccessorElement) {
      PropertyAccessorElement accessor = (PropertyAccessorElement) element;
      element = accessor.getVariable();
    }
    if (element instanceof VariableElement) {
      VariableElement variable = (VariableElement) element;
      if (variable.isConst()) {
        errorReporter.reportErrorForNode(StaticWarningCode.ASSIGNMENT_TO_CONST, expression);
View Full Code Here


      String accessorTextName) {
    ExecutableElement accessorElement = (ExecutableElement) accessorDeclaration.getElement();
    if (!(accessorElement instanceof PropertyAccessorElement)) {
      return false;
    }
    PropertyAccessorElement propertyAccessorElement = (PropertyAccessorElement) accessorElement;
    PropertyAccessorElement counterpartAccessor = null;
    ClassElement enclosingClassForCounterpart = null;
    if (propertyAccessorElement.isGetter()) {
      counterpartAccessor = propertyAccessorElement.getCorrespondingSetter();
    } else {
      counterpartAccessor = propertyAccessorElement.getCorrespondingGetter();
      // If the setter and getter are in the same enclosing element, return, this prevents having
      // MISMATCHED_GETTER_AND_SETTER_TYPES reported twice.
      if (counterpartAccessor != null
          && counterpartAccessor.getEnclosingElement() == propertyAccessorElement.getEnclosingElement()) {
        return false;
      }
    }
    if (counterpartAccessor == null) {
      // If the accessor is declared in a class, check the superclasses.
View Full Code Here

    for (int i = 0; i < missingOverridesArray.length; i++) {
      String newStrMember;
      Element enclosingElement = missingOverridesArray[i].getEnclosingElement();
      String prefix = StringUtilities.EMPTY;
      if (missingOverridesArray[i] instanceof PropertyAccessorElement) {
        PropertyAccessorElement propertyAccessorElement = (PropertyAccessorElement) missingOverridesArray[i];
        if (propertyAccessorElement.isGetter()) {
          prefix = GETTER_SPACE; // "getter "
        } else {
          prefix = SETTER_SPACE; // "setter "
        }
      }
View Full Code Here

      }
      if (foundElt != null && !((MethodElement) foundElt).isAbstract()) {
        return true;
      }
    } else if (executableElt instanceof PropertyAccessorElement) {
      PropertyAccessorElement propertyAccessorElement = (PropertyAccessorElement) executableElt;
      if (propertyAccessorElement.isGetter()) {
        foundElt = classElt.getGetter(executableName);
      }
      if (foundElt == null && propertyAccessorElement.isSetter()) {
        foundElt = classElt.getSetter(executableName);
      }
      if (foundElt != null && !((PropertyAccessorElement) foundElt).isAbstract()) {
        return true;
      }
View Full Code Here

          enclosingExecutable = findIdentifier(enclosingExecutable.getFunctions(), functionName);
        } else {
          enclosingExecutable = findIdentifier(enclosingUnit.getFunctions(), functionName);
        }
      } else {
        PropertyAccessorElement accessor = findIdentifier(
            enclosingUnit.getAccessors(),
            functionName);
        if (((KeywordToken) property).getKeyword() == Keyword.SET) {
          accessor = accessor.getVariable().getSetter();
        }
        enclosingExecutable = accessor;
      }
      processElement(enclosingExecutable);
      return super.visitFunctionDeclaration(node);
View Full Code Here

            enclosingClass.getMethods(),
            nameOfMethod,
            methodName.getOffset());
        methodName.setStaticElement(enclosingExecutable);
      } else {
        PropertyAccessorElement accessor = findIdentifier(enclosingClass.getAccessors(), methodName);
        if (((KeywordToken) property).getKeyword() == Keyword.SET) {
          accessor = accessor.getVariable().getSetter();
          methodName.setStaticElement(accessor);
        }
        enclosingExecutable = accessor;
      }
      processElement(enclosingExecutable);
View Full Code Here

        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

      //
      // This is really a function expression invocation.
      //
      // TODO(brianwilkerson) Consider the possibility of re-writing the AST.
      if (element instanceof PropertyInducingElement) {
        PropertyAccessorElement getter = ((PropertyInducingElement) element).getGetter();
        FunctionType getterType = getter.getType();
        if (getterType != null) {
          Type returnType = getterType.getReturnType();
          if (!isExecutableType(returnType)) {
            return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
          }
View Full Code Here

   */
  private PropertyAccessorElement lookUpGetter(Expression target, Type type, String getterName) {
    type = resolveTypeParameter(type);
    if (type instanceof InterfaceType) {
      InterfaceType interfaceType = (InterfaceType) type;
      PropertyAccessorElement accessor;
      if (target instanceof SuperExpression) {
        accessor = interfaceType.lookUpGetterInSuperclass(getterName, definingLibrary);
      } else {
        accessor = interfaceType.lookUpGetter(getterName, definingLibrary);
      }
View Full Code Here

    if (visitedInterfaces.contains(targetClass)) {
      return null;
    }
    visitedInterfaces.add(targetClass);
    if (includeTargetType) {
      PropertyAccessorElement getter = targetType.getGetter(getterName);
      if (getter != null && getter.isAccessibleIn(definingLibrary)) {
        return getter;
      }
    }
    for (InterfaceType interfaceType : targetType.getInterfaces()) {
      PropertyAccessorElement getter = lookUpGetterInInterfaces(
          interfaceType,
          true,
          getterName,
          visitedInterfaces);
      if (getter != null) {
        return getter;
      }
    }
    for (InterfaceType mixinType : targetType.getMixins()) {
      PropertyAccessorElement getter = lookUpGetterInInterfaces(
          mixinType,
          true,
          getterName,
          visitedInterfaces);
      if (getter != null) {
View Full Code Here

TOP

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

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.