Package com.google.dart.engine.internal.resolver

Examples of com.google.dart.engine.internal.resolver.ResolvableLibrary


     */
    public void computeCycleContaining(Source librarySource) throws AnalysisException {
      //
      // Create the object representing the library being resolved.
      //
      ResolvableLibrary targetLibrary = createLibrary(librarySource);
      //
      // Compute the set of libraries that need to be resolved together.
      //
      dependencyGraph = new DirectedGraph<ResolvableLibrary>();
      computeLibraryDependencies(targetLibrary);
View Full Code Here


        for (int i = 0; i < importCount; i++) {
          Source importedSource = importedSources[i];
          if (importedSource.equals(coreLibrarySource)) {
            explicitlyImportsCore = true;
          }
          ResolvableLibrary importedLibrary = libraryMap.get(importedSource);
          if (importedLibrary == null) {
            importedLibrary = createLibraryOrNull(importedSource);
            if (importedLibrary != null) {
              computeLibraryDependencies(importedLibrary);
              if (taskData != null) {
                return;
              }
            }
          }
          if (importedLibrary != null) {
            importedLibraries.add(importedLibrary);
            dependencyGraph.addEdge(library, importedLibrary);
          }
        }

        library.setExplicitlyImportsCore(explicitlyImportsCore);
        if (!explicitlyImportsCore && !coreLibrarySource.equals(library.getLibrarySource())) {
          ResolvableLibrary importedLibrary = libraryMap.get(coreLibrarySource);
          if (importedLibrary == null) {
            importedLibrary = createLibraryOrNull(coreLibrarySource);
            if (importedLibrary != null) {
              computeLibraryDependencies(importedLibrary);
              if (taskData != null) {
                return;
              }
            }
          }
          if (importedLibrary != null) {
            importedLibraries.add(importedLibrary);
            dependencyGraph.addEdge(library, importedLibrary);
          }
        }

        library.setImportedLibraries(importedLibraries.toArray(new ResolvableLibrary[importedLibraries.size()]));
      } else {
        library.setExplicitlyImportsCore(false);
        ResolvableLibrary importedLibrary = libraryMap.get(coreLibrarySource);
        if (importedLibrary == null) {
          importedLibrary = createLibraryOrNull(coreLibrarySource);
          if (importedLibrary != null) {
            computeLibraryDependencies(importedLibrary);
            if (taskData != null) {
              return;
            }
          }
        }
        if (importedLibrary != null) {
          dependencyGraph.addEdge(library, importedLibrary);
          library.setImportedLibraries(new ResolvableLibrary[] {importedLibrary});
        }
      }

      int exportCount = exportedSources.length;
      if (exportCount > 0) {
        ArrayList<ResolvableLibrary> exportedLibraries = new ArrayList<ResolvableLibrary>(
            exportCount);
        for (int i = 0; i < exportCount; i++) {
          Source exportedSource = exportedSources[i];
          ResolvableLibrary exportedLibrary = libraryMap.get(exportedSource);
          if (exportedLibrary == null) {
            exportedLibrary = createLibraryOrNull(exportedSource);
            if (exportedLibrary != null) {
              computeLibraryDependencies(exportedLibrary);
              if (taskData != null) {
View Full Code Here

     */
    private void computePartsInCycle(Source librarySource) throws AnalysisException {
      int count = librariesInCycle.size();
      ArrayList<LibraryPair> libraryData = new ArrayList<LibraryPair>(count);
      for (int i = 0; i < count; i++) {
        ResolvableLibrary library = librariesInCycle.get(i);
        libraryData.add(new LibraryPair(library, ensurePartsInLibrary(library)));
      }
      neededForResolution = gatherSources(libraryData);
      if (TRACE_PERFORM_TASK) {
        System.out.println("  preserve resolution data for " + neededForResolution.size()
View Full Code Here

     *
     * @param libraryPair a holder containing both the library and a list of (source, entry) pairs
     *          for all of the compilation units in the library
     */
    private void computePartsInLibrary(LibraryPair libraryPair) {
      ResolvableLibrary library = libraryPair.library;
      ArrayList<SourceEntryPair> entryPairs = libraryPair.entryPairs;
      int count = entryPairs.size();
      ResolvableCompilationUnit[] units = new ResolvableCompilationUnit[count];
      for (int i = 0; i < count; i++) {
        SourceEntryPair entryPair = entryPairs.get(i);
        Source source = entryPair.source;
        DartEntryImpl dartCopy = entryPair.entry.getWritableCopy();
        units[i] = new ResolvableCompilationUnit(
            dartCopy.getModificationTime(),
            dartCopy.getResolvableCompilationUnit(),
            source);
        cache.put(source, dartCopy);
      }
      library.setResolvableCompilationUnits(units);
    }
View Full Code Here

     *
     * @param librarySource the source of the library's defining compilation unit
     * @return the library object that was created
     */
    private ResolvableLibrary createLibrary(Source librarySource) {
      ResolvableLibrary library = new ResolvableLibrary(librarySource);
      SourceEntry sourceEntry = cache.get(librarySource);
      if (sourceEntry instanceof DartEntry) {
        LibraryElementImpl libraryElement = (LibraryElementImpl) sourceEntry.getValue(DartEntry.ELEMENT);
        if (libraryElement != null) {
          library.setLibraryElement(libraryElement);
        }
      }
      libraryMap.put(librarySource, library);
      return library;
    }
View Full Code Here

     *
     * @param librarySource the source of the library's defining compilation unit
     * @return the library object that was created
     */
    private ResolvableLibrary createLibraryOrNull(Source librarySource) {
      ResolvableLibrary library = new ResolvableLibrary(librarySource);
      SourceEntry sourceEntry = cache.get(librarySource);
      if (sourceEntry instanceof DartEntry) {
        LibraryElementImpl libraryElement = (LibraryElementImpl) sourceEntry.getValue(DartEntry.ELEMENT);
        if (libraryElement != null) {
          library.setLibraryElement(libraryElement);
        }
      }
      libraryMap.put(librarySource, library);
      return library;
    }
View Full Code Here

     */
    private void ensureExports(ResolvableLibrary library, HashSet<Source> visitedLibraries) {
      ResolvableLibrary[] dependencies = library.getExports();
      int dependencyCount = dependencies.length;
      for (int i = 0; i < dependencyCount; i++) {
        ResolvableLibrary dependency = dependencies[i];
        if (!librariesInCycle.contains(dependency)
            && visitedLibraries.add(dependency.getLibrarySource())) {
          if (dependency.getLibraryElement() == null) {
            ensureElementModel(dependency);
          } else {
            ensureExports(dependency, visitedLibraries);
          }
          if (taskData != null) {
View Full Code Here

     */
    private void ensureImports(ResolvableLibrary library) {
      ResolvableLibrary[] dependencies = library.getImports();
      int dependencyCount = dependencies.length;
      for (int i = 0; i < dependencyCount; i++) {
        ResolvableLibrary dependency = dependencies[i];
        if (!librariesInCycle.contains(dependency) && dependency.getLibraryElement() == null) {
          ensureElementModel(dependency);
          if (taskData != null) {
            return;
          }
        }
View Full Code Here

     */
    private void ensureImportsAndExports() {
      HashSet<Source> visitedLibraries = new HashSet<Source>();
      int libraryCount = librariesInCycle.size();
      for (int i = 0; i < libraryCount; i++) {
        ResolvableLibrary library = librariesInCycle.get(i);
        ensureImports(library);
        if (taskData != null) {
          return;
        }
        ensureExports(library, visitedLibraries);
View Full Code Here

TOP

Related Classes of com.google.dart.engine.internal.resolver.ResolvableLibrary

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.