| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
| 9 * compiled. | 9 * compiled. |
| 10 */ | 10 */ |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 | 1053 |
| 1054 log('Resolving...'); | 1054 log('Resolving...'); |
| 1055 phase = PHASE_RESOLVING; | 1055 phase = PHASE_RESOLVING; |
| 1056 if (analyzeAll) { | 1056 if (analyzeAll) { |
| 1057 libraries.forEach( | 1057 libraries.forEach( |
| 1058 (_, lib) => fullyEnqueueLibrary(lib, enqueuer.resolution)); | 1058 (_, lib) => fullyEnqueueLibrary(lib, enqueuer.resolution)); |
| 1059 } | 1059 } |
| 1060 // Elements required by enqueueHelpers are global dependencies | 1060 // Elements required by enqueueHelpers are global dependencies |
| 1061 // that are not pulled in by a particular element. | 1061 // that are not pulled in by a particular element. |
| 1062 backend.enqueueHelpers(enqueuer.resolution, globalDependencies); | 1062 backend.enqueueHelpers(enqueuer.resolution, globalDependencies); |
| 1063 resolveLibraryMetadata(); |
| 1063 processQueue(enqueuer.resolution, main); | 1064 processQueue(enqueuer.resolution, main); |
| 1064 enqueuer.resolution.logSummary(log); | 1065 enqueuer.resolution.logSummary(log); |
| 1065 | 1066 |
| 1066 if (compilationFailed) return; | 1067 if (compilationFailed) return; |
| 1067 if (analyzeOnly) return; | 1068 if (analyzeOnly) return; |
| 1068 assert(main != null); | 1069 assert(main != null); |
| 1069 phase = PHASE_DONE_RESOLVING; | 1070 phase = PHASE_DONE_RESOLVING; |
| 1070 | 1071 |
| 1071 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution | 1072 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution |
| 1072 // should know this. | 1073 // should know this. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 if (element.isClass()) { | 1121 if (element.isClass()) { |
| 1121 ClassElement cls = element; | 1122 ClassElement cls = element; |
| 1122 cls.ensureResolved(this); | 1123 cls.ensureResolved(this); |
| 1123 cls.forEachLocalMember(enqueuer.resolution.addToWorkList); | 1124 cls.forEachLocalMember(enqueuer.resolution.addToWorkList); |
| 1124 world.registerInstantiatedClass(element, globalDependencies); | 1125 world.registerInstantiatedClass(element, globalDependencies); |
| 1125 } else { | 1126 } else { |
| 1126 world.addToWorkList(element); | 1127 world.addToWorkList(element); |
| 1127 } | 1128 } |
| 1128 } | 1129 } |
| 1129 | 1130 |
| 1131 // Resolves metadata on library elements. This is necessary in order to |
| 1132 // resolve metadata classes referenced only from metadata on library tags. |
| 1133 // TODO(ahe): Figure out how to do this lazily. |
| 1134 void resolveLibraryMetadata() { |
| 1135 for (LibraryElement library in libraries.values) { |
| 1136 for (MetadataAnnotation metadata in library.metadata) { |
| 1137 metadata.ensureResolved(this); |
| 1138 } |
| 1139 } |
| 1140 } |
| 1141 |
| 1130 void processQueue(Enqueuer world, Element main) { | 1142 void processQueue(Enqueuer world, Element main) { |
| 1131 world.nativeEnqueuer.processNativeClasses(libraries.values); | 1143 world.nativeEnqueuer.processNativeClasses(libraries.values); |
| 1132 if (main != null) { | 1144 if (main != null) { |
| 1133 world.addToWorkList(main); | 1145 world.addToWorkList(main); |
| 1134 } | 1146 } |
| 1135 progress.reset(); | 1147 progress.reset(); |
| 1136 world.forEach((WorkItem work) { | 1148 world.forEach((WorkItem work) { |
| 1137 withCurrentElement(work.element, () => work.run(this, world)); | 1149 withCurrentElement(work.element, () => work.run(this, world)); |
| 1138 }); | 1150 }); |
| 1139 world.queueIsClosed = true; | 1151 world.queueIsClosed = true; |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 | 1614 |
| 1603 void close() {} | 1615 void close() {} |
| 1604 | 1616 |
| 1605 toString() => name; | 1617 toString() => name; |
| 1606 | 1618 |
| 1607 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1619 /// Convenience method for getting an [api.CompilerOutputProvider]. |
| 1608 static NullSink outputProvider(String name, String extension) { | 1620 static NullSink outputProvider(String name, String extension) { |
| 1609 return new NullSink('$name.$extension'); | 1621 return new NullSink('$name.$extension'); |
| 1610 } | 1622 } |
| 1611 } | 1623 } |
| OLD | NEW |