Package com.google.dart.engine.element

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


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


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

      // element2 should be ClassElement
      if (element2 instanceof ClassElement) {
        ClassElement classElement = (ClassElement) element2;
        String name3 = nameNode3.getName();
        // prefix.Class.CONST
        PropertyAccessorElement getter = classElement.lookUpGetter(name3, definingLibrary);
        if (getter != null) {
          nameNode3.setStaticElement(getter);
          annotation.setElement(element2);
          resolveAnnotationElementGetter(annotation, getter);
          return;
View Full Code Here

  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

    if (definingClass != null) {
      type.setTypeArguments(definingClass.getType().getTypeArguments());
    }
    element.setType(type);
    if (element instanceof PropertyAccessorElement) {
      PropertyAccessorElement accessor = (PropertyAccessorElement) element;
      PropertyInducingElementImpl variable = (PropertyInducingElementImpl) accessor.getVariable();
      if (accessor.isGetter()) {
        variable.setType(type.getReturnType());
      } else if (variable.getType() == null) {
        Type[] parameterTypes = type.getNormalParameterTypes();
        if (parameterTypes != null && parameterTypes.length > 0) {
          variable.setType(parameterTypes[0]);
View Full Code Here

    collectAccessors(getters, setters, libraryElement.getDefiningCompilationUnit());
    for (CompilationUnitElement unit : libraryElement.getParts()) {
      collectAccessors(getters, setters, unit);
    }
    for (PropertyAccessorElement setter : setters) {
      PropertyAccessorElement getter = getters.get(setter.getDisplayName());
      if (getter != null) {
        PropertyInducingElementImpl variable = (PropertyInducingElementImpl) getter.getVariable();
        variable.setSetter(setter);
        ((PropertyAccessorElementImpl) setter).setVariable(variable);
      }
    }
  }
View Full Code Here

          if (arguments.size() == 1) {
            Expression argument = arguments.get(0);
            if (argument instanceof StringLiteral) {
              String value = ((StringLiteral) argument).getStringValue();
              if ("2d".equals(value)) {
                PropertyAccessorElement getter = ((InterfaceType) targetType).getElement().getGetter(
                    "context2D");
                if (getter != null) {
                  Type returnType = getter.getReturnType();
                  if (returnType != null) {
                    recordPropagatedType(node, returnType);
                    needPropagatedType = false;
                  }
                }
View Full Code Here

  /**
   * Return the propagated type of the given {@link Element}, or {@code null}.
   */
  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

    if (accessor.isSetter()) {
      Type[] parameterTypes = functionType.getNormalParameterTypes();
      if (parameterTypes != null && parameterTypes.length > 0) {
        return parameterTypes[0];
      }
      PropertyAccessorElement getter = accessor.getVariable().getGetter();
      if (getter != null) {
        functionType = getter.getType();
        if (functionType != null) {
          return functionType.getReturnType();
        }
      }
      return dynamicType;
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();
          functionName.setStaticElement(accessor);
        }
        enclosingExecutable = accessor;
      }
      node.getFunctionExpression().setElement(enclosingExecutable);
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.