Package com.google.dart.engine.element

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


    if (element == null) {
      //
      // If it isn't defined in the lexical scope, and the invocation is within a class, then look
      // in the inheritance scope.
      //
      ClassElement enclosingClass = resolver.getEnclosingClass();
      if (enclosingClass != null) {
        InterfaceType enclosingType = enclosingClass.getType();
        element = lookUpMethod(null, enclosingType, methodName.getName());
        if (element == null) {
          //
          // If there's no method, then it's possible that 'm' is a getter that returns a function.
          //
View Full Code Here


              ? propagatedType.getDisplayName() : staticType.getDisplayName();

      // Special getter cases.
      if (propertyName.inGetterContext()) {
        if (!isStaticProperty && staticOrPropagatedEnclosingElt instanceof ClassElement) {
          ClassElement classElement = (ClassElement) staticOrPropagatedEnclosingElt;
          InterfaceType targetType = classElement.getType();
          if (targetType != null && targetType.isDartCoreFunction()
              && propertyName.getName().equals(FunctionElement.CALL_METHOD_NAME)) {
            // TODO(brianwilkerson) Can we ever resolve the function being invoked?
            //resolveArgumentsToParameters(node.getArgumentList(), invokedFunction);
            return;
          } else if (classElement.isEnum() && propertyName.getName().equals("_name")) {
            resolver.reportErrorForNode(
                CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD,
                propertyName,
                propertyName.getName());
            return;
View Full Code Here

        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();
          if (enclosingClass != null) {
            setter = lookUpSetter(null, enclosingClass.getType(), node.getName());
          }
        }
        if (setter != null) {
          element = setter;
        }
      }
    } else if (element == null
        && (node.inSetterContext() || node.getParent() instanceof CommentReference)) {
      element = resolver.getNameScope().lookup(
          new SyntheticIdentifier(node.getName() + "="),
          definingLibrary);
    }
    ClassElement enclosingClass = resolver.getEnclosingClass();
    if (element == null && enclosingClass != null) {
      InterfaceType enclosingType = enclosingClass.getType();
      if (element == null
          && (node.inSetterContext() || node.getParent() instanceof CommentReference)) {
        element = lookUpSetter(null, enclosingType, node.getName());
      }
      if (element == null && node.inGetterContext()) {
View Full Code Here

    }
    enclosingClassDeclaration = node;
    //
    // Continue the class resolution.
    //
    ClassElement outerType = enclosingClass;
    try {
      enclosingClass = node.getElement();
      typeAnalyzer.setThisType(enclosingClass == null ? null : enclosingClass.getType());
      super.visitClassDeclaration(node);
      node.accept(elementResolver);
      node.accept(typeAnalyzer);
    } finally {
      typeAnalyzer.setThisType(outerType == null ? null : outerType.getType());
      enclosingClass = outerType;
      enclosingClassDeclaration = null;
    }
    return null;
  }
View Full Code Here

    if (superclassType == null) {
      superclassType = getTypeProvider().getObjectType();
    }
    if (classElement != null && superclassType != null) {
      classElement.setSupertype(superclassType);
      ClassElement superclassElement = superclassType.getElement();
      if (superclassElement != null) {
        ConstructorElement[] constructors = superclassElement.getConstructors();
        int count = constructors.length;
        if (count > 0) {
          Type[] parameterTypes = TypeParameterTypeImpl.getTypes(superclassType.getTypeParameters());
          Type[] argumentTypes = getArgumentTypes(
              node.getSuperclass().getTypeArguments(),
View Full Code Here

      builder.append(" in ");
      builder.append(getSource().getFullName());
      builder.append(" was not set while trying to resolve types.");
      AnalysisEngine.getInstance().getLogger().logError(builder.toString(), new AnalysisException());
    } else {
      ClassElement definingClass = (ClassElement) element.getEnclosingElement();
      element.setReturnType(definingClass.getType());
      FunctionTypeImpl type = new FunctionTypeImpl(element);
      type.setTypeArguments(definingClass.getType().getTypeArguments());
      element.setType(type);
    }
    return null;
  }
View Full Code Here

      builder.append(" was not set while trying to resolve types.");
      AnalysisEngine.getInstance().getLogger().logError(builder.toString(), new AnalysisException());
    }
    element.setReturnType(computeReturnType(node.getReturnType()));
    FunctionTypeImpl type = new FunctionTypeImpl(element);
    ClassElement definingClass = element.getAncestor(ClassElement.class);
    if (definingClass != null) {
      type.setTypeArguments(definingClass.getType().getTypeArguments());
    }
    element.setType(type);
    return null;
  }
View Full Code Here

      builder.append(" was not set while trying to resolve types.");
      AnalysisEngine.getInstance().getLogger().logError(builder.toString(), new AnalysisException());
    }
    element.setReturnType(computeReturnType(node.getReturnType()));
    FunctionTypeImpl type = new FunctionTypeImpl(element);
    ClassElement definingClass = element.getAncestor(ClassElement.class);
    if (definingClass != null) {
      type.setTypeArguments(definingClass.getType().getTypeArguments());
    }
    element.setType(type);
    if (element instanceof PropertyAccessorElement) {
      PropertyAccessorElement accessor = (PropertyAccessorElement) element;
      PropertyInducingElementImpl variable = (PropertyInducingElementImpl) accessor.getVariable();
View Full Code Here

      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);
          }
          setter.setReturnType(VoidTypeImpl.getInstance());
          FunctionTypeImpl setterType = new FunctionTypeImpl(setter);
          if (definingClass != null) {
            setterType.setTypeArguments(definingClass.getType().getTypeArguments());
          }
          setter.setType(setterType);
        }
      }
    } else {
View Full Code Here

   */
  private InterfaceType resolveType(TypeName typeName, ErrorCode nonTypeError,
      ErrorCode enumTypeError, ErrorCode dynamicTypeError) {
    Type type = typeName.getType();
    if (type instanceof InterfaceType) {
      ClassElement element = ((InterfaceType) type).getElement();
      if (element != null && element.isEnum()) {
        reportErrorForNode(enumTypeError, typeName);
        return null;
      }
      return (InterfaceType) type;
    }
View Full Code Here

TOP

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

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.