Package com.jetbrains.lang.dart.resolve

Examples of com.jetbrains.lang.dart.resolve.ComponentNameScopeProcessor


  public TreeElement[] getChildren() {
    final List<DartComponent> dartComponents = new ArrayList<DartComponent>();
    if (myElement instanceof DartFile || myElement instanceof DartEmbeddedContent) {
      THashSet<DartComponentName> componentNames = new THashSet<DartComponentName>();
      DartPsiCompositeElementImpl
        .processDeclarationsImpl(myElement, new ComponentNameScopeProcessor(componentNames), ResolveState.initial(), null);
      for (DartComponentName componentName : componentNames) {
        PsiElement parent = componentName.getParent();
        if (parent instanceof DartComponent) {
          dartComponents.add((DartComponent)parent);
        }
View Full Code Here


                                           @NotNull CompletionResultSet result) {
               final DartReference reference = PsiTreeUtil.getParentOfType(parameters.getPosition(), DartReference.class);
               final PsiElement library = reference == null ? null : resolveLibrary(reference);
               if (library != null) {
                 final Set<DartComponentName> suggestedVariants = new THashSet<DartComponentName>();
                 DartResolveUtil.processTopLevelDeclarations(reference, new ComponentNameScopeProcessor(suggestedVariants),
                                                             DartResolveUtil.getRealVirtualFile(library.getContainingFile()), null);
                 for (DartLookupElement element : DartLookupElement.convert(suggestedVariants, false)) {
                   result.addElement(element);
                 }
               }
View Full Code Here

  private static Collection<DartLookupElement> addCompletionVariants(@NotNull DartReference reference,
                                                                     Set<DartComponentName> suggestedVariants) {
    DartClass dartClass = null;
    // if do not contain references
    if (DartResolveUtil.aloneOrFirstInChain(reference)) {
      DartResolveUtil.treeWalkUpAndTopLevelDeclarations(reference, new ComponentNameScopeProcessor(suggestedVariants));
      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);
      }
    }

    if (dartClass != null) {
      final boolean needFilterPrivateMembers = !DartResolveUtil.sameLibrary(reference, dartClass);
View Full Code Here

    }));
  }

  public static Set<DartComponentName> collectUsedComponents(PsiElement context) {
    final Set<DartComponentName> usedComponentNames = new THashSet<DartComponentName>();
    PsiTreeUtil.treeWalkUp(new ComponentNameScopeProcessor(usedComponentNames), context, null, ResolveState.initial());
    return usedComponentNames;
  }
View Full Code Here

TOP

Related Classes of com.jetbrains.lang.dart.resolve.ComponentNameScopeProcessor

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.