Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/context/AnalysisContextImpl.java

Issue 411603002: Version 1.5.8 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.5/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. 2 * Copyright (c) 2012, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 LibraryElementImpl libraryElement = (LibraryElementImpl) sourceEntry.get Value(DartEntry.ELEMENT); 611 LibraryElementImpl libraryElement = (LibraryElementImpl) sourceEntry.get Value(DartEntry.ELEMENT);
612 if (libraryElement != null) { 612 if (libraryElement != null) {
613 library.setLibraryElement(libraryElement); 613 library.setLibraryElement(libraryElement);
614 } 614 }
615 } 615 }
616 libraryMap.put(librarySource, library); 616 libraryMap.put(librarySource, library);
617 return library; 617 return library;
618 } 618 }
619 619
620 /** 620 /**
621 * Ensure that the given library has an element model built for it. If anoth er task needs to be
622 * executed first in order to build the element model, that task is placed i n {@link #taskData}.
623 *
624 * @param library the library which needs an element model.
625 */
626 private void ensureElementModel(ResolvableLibrary library) {
627 Source librarySource = library.getLibrarySource();
628 DartEntry libraryEntry = getReadableDartEntry(librarySource);
629 if (libraryEntry != null && libraryEntry.getState(DartEntry.PARSED_UNIT) ! = CacheState.ERROR) {
630 workManager.addFirst(librarySource, SourcePriority.LIBRARY);
631 if (taskData == null) {
632 taskData = createResolveDartLibraryTask(librarySource, libraryEntry);
633 }
634 }
635 }
636
637 /**
621 * Ensure that all of the libraries that are exported by the given library ( but are not 638 * Ensure that all of the libraries that are exported by the given library ( but are not
622 * themselves in the cycle) have element models built for them. 639 * themselves in the cycle) have element models built for them. If another t ask needs to be
640 * executed first in order to build the element model, that task is placed i n {@link #taskData}.
623 * 641 *
624 * @param library the library being tested 642 * @param library the library being tested
625 */ 643 */
626 private void ensureExports(ResolvableLibrary library, HashSet<Source> visite dLibraries) { 644 private void ensureExports(ResolvableLibrary library, HashSet<Source> visite dLibraries) {
627 ResolvableLibrary[] dependencies = library.getExports(); 645 ResolvableLibrary[] dependencies = library.getExports();
628 int dependencyCount = dependencies.length; 646 int dependencyCount = dependencies.length;
629 for (int i = 0; i < dependencyCount; i++) { 647 for (int i = 0; i < dependencyCount; i++) {
630 ResolvableLibrary dependency = dependencies[i]; 648 ResolvableLibrary dependency = dependencies[i];
631 if (!librariesInCycle.contains(dependency) 649 if (!librariesInCycle.contains(dependency)
632 && visitedLibraries.add(dependency.getLibrarySource())) { 650 && visitedLibraries.add(dependency.getLibrarySource())) {
633 if (dependency.getLibraryElement() == null) { 651 if (dependency.getLibraryElement() == null) {
634 Source dependencySource = dependency.getLibrarySource(); 652 ensureElementModel(dependency);
635 workManager.addFirst(dependencySource, SourcePriority.LIBRARY);
636 if (taskData == null) {
637 taskData = createResolveDartLibraryTask(
638 dependencySource,
639 getReadableDartEntry(dependencySource));
640 return;
641 }
642 } else { 653 } else {
643 ensureExports(dependency, visitedLibraries); 654 ensureExports(dependency, visitedLibraries);
644 if (taskData != null) { 655 }
645 return; 656 if (taskData != null) {
646 } 657 return;
647 } 658 }
648 } 659 }
649 } 660 }
650 } 661 }
651 662
652 /** 663 /**
653 * Ensure that all of the libraries that are exported by the given library ( but are not 664 * Ensure that all of the libraries that are exported by the given library ( but are not
654 * themselves in the cycle) have element models built for them. 665 * themselves in the cycle) have element models built for them. If another t ask needs to be
666 * executed first in order to build the element model, that task is placed i n {@link #taskData}.
655 * 667 *
656 * @param library the library being tested 668 * @param library the library being tested
657 * @throws MissingDataException if there is at least one library being depen ded on that does not
658 * have an element model built for it
659 */ 669 */
660 private void ensureImports(ResolvableLibrary library) { 670 private void ensureImports(ResolvableLibrary library) {
661 ResolvableLibrary[] dependencies = library.getImports(); 671 ResolvableLibrary[] dependencies = library.getImports();
662 int dependencyCount = dependencies.length; 672 int dependencyCount = dependencies.length;
663 for (int i = 0; i < dependencyCount; i++) { 673 for (int i = 0; i < dependencyCount; i++) {
664 ResolvableLibrary dependency = dependencies[i]; 674 ResolvableLibrary dependency = dependencies[i];
665 if (!librariesInCycle.contains(dependency) && dependency.getLibraryEleme nt() == null) { 675 if (!librariesInCycle.contains(dependency) && dependency.getLibraryEleme nt() == null) {
666 Source dependencySource = dependency.getLibrarySource(); 676 ensureElementModel(dependency);
667 workManager.addFirst(dependencySource, SourcePriority.LIBRARY); 677 if (taskData != null) {
668 if (taskData == null) {
669 taskData = createResolveDartLibraryTask(
670 dependencySource,
671 getReadableDartEntry(dependencySource));
672 return; 678 return;
673 } 679 }
674 } 680 }
675 } 681 }
676 } 682 }
677 683
678 /** 684 /**
679 * Ensure that all of the libraries that are either imported or exported by libraries in the 685 * Ensure that all of the libraries that are either imported or exported by libraries in the
680 * cycle (but are not themselves in the cycle) have element models built for them. 686 * cycle (but are not themselves in the cycle) have element models built for them.
681 */ 687 */
(...skipping 5115 matching lines...) Expand 10 before | Expand all | Expand 10 after
5797 writer.println(" missing sources"); 5803 writer.println(" missing sources");
5798 for (Source source : missingSources) { 5804 for (Source source : missingSources) {
5799 writer.print(" "); 5805 writer.print(" ");
5800 writer.println(source.getFullName()); 5806 writer.println(source.getFullName());
5801 } 5807 }
5802 logInformation(writer.toString()); 5808 logInformation(writer.toString());
5803 } 5809 }
5804 return changedSources.size() > 0; 5810 return changedSources.size() > 0;
5805 } 5811 }
5806 } 5812 }
OLDNEW
« no previous file with comments | « no previous file | dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698