Package com.jetbrains.lang.dart.util

Examples of com.jetbrains.lang.dart.util.DartClassResolveResult


      dartClass = PsiTreeUtil.getParentOfType(reference, DartClass.class);
    }

    final DartReference leftReference = DartResolveUtil.getLeftReference(reference);
    if (leftReference != null) {
      final DartClassResolveResult classResolveResult = leftReference.resolveDartClass();
      dartClass = classResolveResult.getDartClass();
      // prefix
      if (PsiTreeUtil.getParentOfType(leftReference.resolve(), DartImportStatement.class, DartExportStatement.class) != null) {
        final VirtualFile virtualFile =
          DartResolveUtil.getImportedFileByImportPrefix(reference.getContainingFile(), leftReference.getText());
        DartResolveUtil.processTopLevelDeclarations(reference, new ComponentNameScopeProcessor(suggestedVariants), virtualFile, null);
View Full Code Here


    final List<DartClass> supers = new ArrayList<DartClass>();
    final DartType superClass = dartClass.getSuperClass();
    // looks like there's no sense in jumping to Object class
    if (superClass != null && !DartResolveUtil.OBJECT.equals(superClass.getName())) {
      final DartClassResolveResult dartClassResolveResult = DartResolveUtil.resolveClassByType(superClass);
      if (dartClassResolveResult.getDartClass() != null) {
        supers.add(dartClassResolveResult.getDartClass());
      }
    }

    List<DartClassResolveResult> implementsAndMixinsList =
      DartResolveUtil.resolveClassesByTypes(DartResolveUtil.getImplementsAndMixinsList(dartClass));
    for (DartClassResolveResult resolveResult : implementsAndMixinsList) {
      final DartClass resolveResultDartClass = resolveResult.getDartClass();
      if (resolveResultDartClass != null) {
        supers.add(resolveResultDartClass);
      }
    }

    if(supers.size() == 0) {
      final DartClassResolveResult dartClassResolveResult = dartClass.getSuperClassResolvedOrObjectClass();
      if(dartClassResolveResult != null) {
        final DartClass superDartClass = dartClassResolveResult.getDartClass();
        if (superDartClass != null && superDartClass.getName().equals(DartResolveUtil.OBJECT)) {
          supers.add(superDartClass);
        }
      }
    }
View Full Code Here

  public static DartFunctionDescription tryGetDescription(DartCallExpression callExpression) {
    final PsiElement target = ((DartReference)callExpression.getExpression()).resolve();
    final PsiElement targetParent = target == null ? null : target.getParent();
    if (target instanceof DartComponentName && targetParent instanceof DartComponent) {
      final DartReference[] references = PsiTreeUtil.getChildrenOfType(callExpression.getExpression(), DartReference.class);
      final DartClassResolveResult resolveResult = (references != null && references.length == 2)
                                                   ? references[0].resolveDartClass()
                                                   : DartClassResolveResult
                                                     .create(PsiTreeUtil.getParentOfType(callExpression, DartClass.class));
      return createDescription((DartComponent)targetParent, resolveResult);
    }
View Full Code Here

    final List<DartClass> supers = new ArrayList<DartClass>();
    final DartType superClass = dartClass.getSuperClass();
    // looks like there's no sense in jumping to Object class
    if (superClass != null && !DartResolveUtil.OBJECT.equals(superClass.getReferenceExpression().getText())) {
      final DartClassResolveResult dartClassResolveResult = DartResolveUtil.resolveClassByType(superClass);
      if (dartClassResolveResult.getDartClass() != null) {
        supers.add(dartClassResolveResult.getDartClass());
      }
    }

    List<DartClassResolveResult> implementsAndMixinsList =
      DartResolveUtil.resolveClassesByTypes(DartResolveUtil.getImplementsAndMixinsList(dartClass));
View Full Code Here

  private static DartClass[] createSuperClasses(final DartClass dartClass) {
    if (!dartClass.isValid()) return new DartClass[0];
    final ArrayList<DartClass> superClasses = new ArrayList<DartClass>();
    DartType superType = dartClass.getSuperClass();
    while (superType != null && !DartResolveUtil.OBJECT.equals(superType.getReferenceExpression().getText())) {
      final DartClassResolveResult dartClassResolveResult = DartResolveUtil.resolveClassByType(superType);
      final DartClass dartClass1 = dartClassResolveResult.getDartClass();
      if (dartClass1 != null) {
        superClasses.add(dartClass1);
        superType = dartClass1.getSuperClass();
      }
    }
View Full Code Here

      functionDescription = DartFunctionDescription.tryGetDescription((DartCallExpression)element);
    }
    else if (element instanceof DartNewExpression) {
      final DartNewExpression newExpression = (DartNewExpression)element;
      final DartType type = newExpression.getType();
      final DartClassResolveResult classResolveResult = DartResolveUtil.resolveClassByType(type);
      PsiElement psiElement = ((DartNewExpression)element).getReferenceExpression();
      psiElement = psiElement == null && type != null ? type.getReferenceExpression() : psiElement;
      final PsiElement target = psiElement != null ? ((DartReference)psiElement).resolve() : null;
      if (target instanceof DartComponentName) {
        functionDescription = DartFunctionDescription.createDescription((DartComponent)target.getParent(), classResolveResult);
View Full Code Here

      public boolean value(DartComponentName name) {
        final PsiElement nameParent = name.getParent();
        if (nameParent instanceof DartClass) {
          return false;
        }
        final DartClassResolveResult result = DartResolveUtil.getDartClassResolveResult(nameParent);
        final DartClass dartClass = result.getDartClass();
        return dartClass != null && filter(dartClass);
      }
    });
    return filtered.isEmpty() ? null : new PsiElementResult(filtered.iterator().next());
  }
View Full Code Here

  private static DartClass getClass(final PsiElement reference) {
    if (reference == null) return null;
    final DartReference leftReference = DartResolveUtil.getLeftReference(reference);
    if (leftReference != null) {
      final DartClassResolveResult resolveResult = DartResolveUtil.getDartClassResolveResult(leftReference);
      return resolveResult.getDartClass();
    }
    return PsiTreeUtil.getParentOfType(reference, DartClass.class);
  }
View Full Code Here

    if (this instanceof DartSuperExpression) {
      final DartClass dartClass = PsiTreeUtil.getParentOfType(this, DartClass.class);
      return dartClass == null ? DartClassResolveResult.EMPTY : dartClass.getSuperClassResolvedOrObjectClass();
    }
    if (this instanceof DartNewExpression || this instanceof DartConstConstructorExpression) {
      final DartClassResolveResult result = DartResolveUtil.resolveClassByType(PsiTreeUtil.getChildOfType(this, DartType.class));
      result.specialize(this);
      return result;
    }
    if (this instanceof DartCallExpression) {
      final DartExpression expression = ((DartCallExpression)this).getExpression();
      final DartClassResolveResult leftResult = tryGetLeftResolveResult(expression);
      if (expression instanceof DartReference) {
        final DartClassResolveResult result =
          DartResolveUtil.getDartClassResolveResult(((DartReference)expression).resolve(), leftResult.getSpecialization());
        result.specialize(this);
        return result;
      }
    }
    if (this instanceof DartCascadeReferenceExpression) {
      DartReference[] children = PsiTreeUtil.getChildrenOfType(this, DartReference.class);
View Full Code Here

    }

    if (this instanceof DartArrayAccessExpression) {
      final DartReference reference = PsiTreeUtil.getChildOfType(this, DartReference.class);
      if (reference != null) {
        final DartClassResolveResult resolveResult = reference.resolveDartClass();
        final DartClass resolveResultDartClass = resolveResult.getDartClass();
        if (resolveResultDartClass == null) {
          return resolveResult;
        }
        return DartResolveUtil.getDartClassResolveResult(resolveResultDartClass.findOperator("[]", null),
                                                         resolveResult.getSpecialization());
      }
    }

    if (this instanceof DartAsExpression) {
      return DartResolveUtil.resolveClassByType(((DartAsExpression)this).getType());
    }

    if (this instanceof DartStringLiteralExpression) {
      return DartResolveUtil.findCoreClass(this, "String");
    }

    if (this instanceof DartListLiteralExpression) {
      final DartClassResolveResult classResolveResult = DartResolveUtil.findCoreClass(this, "List");
      classResolveResult.specializeByParameters(((DartListLiteralExpression)this).getTypeArguments());
      return classResolveResult;
    }

    if (this instanceof DartMapLiteralExpression) {
      final DartClassResolveResult classResolveResult = DartResolveUtil.findCoreClass(this, "Map");
      classResolveResult.specializeByParameters(((DartMapLiteralExpression)this).getTypeArguments());
      return classResolveResult;
    }

    final PsiElement firstChild = getFirstChild();
    if (firstChild instanceof LeafPsiElement) {
View Full Code Here

TOP

Related Classes of com.jetbrains.lang.dart.util.DartClassResolveResult

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.