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 library dart2js.compiler_base; | 5 library dart2js.compiler_base; |
6 | 6 |
7 import 'dart:async' show EventSink, Future; | 7 import 'dart:async' show EventSink, Future; |
8 | 8 |
9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
10 import 'cache_strategy.dart' show CacheStrategy; | 10 import 'cache_strategy.dart' show CacheStrategy; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 import 'tokens/token_map.dart' show TokenMap; | 69 import 'tokens/token_map.dart' show TokenMap; |
70 import 'tracer.dart' show Tracer; | 70 import 'tracer.dart' show Tracer; |
71 import 'tree/tree.dart' show Node, TypeAnnotation; | 71 import 'tree/tree.dart' show Node, TypeAnnotation; |
72 import 'typechecker.dart' show TypeCheckerTask; | 72 import 'typechecker.dart' show TypeCheckerTask; |
73 import 'types/types.dart' show GlobalTypeInferenceTask; | 73 import 'types/types.dart' show GlobalTypeInferenceTask; |
74 import 'types/masks.dart' show CommonMasks; | 74 import 'types/masks.dart' show CommonMasks; |
75 import 'universe/selector.dart' show Selector; | 75 import 'universe/selector.dart' show Selector; |
76 import 'universe/world_builder.dart' | 76 import 'universe/world_builder.dart' |
77 show ResolutionWorldBuilder, CodegenWorldBuilder; | 77 show ResolutionWorldBuilder, CodegenWorldBuilder; |
78 import 'universe/use.dart' show StaticUse; | 78 import 'universe/use.dart' show StaticUse; |
79 import 'universe/world_impact.dart' show ImpactStrategy, WorldImpact, WorldImpac
tBuilderImpl; | 79 import 'universe/world_impact.dart' |
| 80 show |
| 81 ImpactStrategy, |
| 82 WorldImpact, |
| 83 WorldImpactBuilder, |
| 84 WorldImpactBuilderImpl; |
80 import 'util/util.dart' show Link, Setlet; | 85 import 'util/util.dart' show Link, Setlet; |
81 import 'world.dart' show ClosedWorld, ClosedWorldRefiner, OpenWorld, WorldImpl; | 86 import 'world.dart' show ClosedWorld, ClosedWorldRefiner, OpenWorld, WorldImpl; |
82 | 87 |
83 typedef Backend MakeBackendFuncion(Compiler compiler); | 88 typedef Backend MakeBackendFuncion(Compiler compiler); |
84 | 89 |
85 typedef CompilerDiagnosticReporter MakeReporterFunction( | 90 typedef CompilerDiagnosticReporter MakeReporterFunction( |
86 Compiler compiler, CompilerOptions options); | 91 Compiler compiler, CompilerOptions options); |
87 | 92 |
88 abstract class Compiler implements LibraryLoaderListener { | 93 abstract class Compiler implements LibraryLoaderListener { |
89 Measurer get measurer; | 94 Measurer get measurer; |
90 | 95 |
91 final IdGenerator idGenerator = new IdGenerator(); | 96 final IdGenerator idGenerator = new IdGenerator(); |
92 WorldImpl _world; | 97 WorldImpl get _world => resolverWorld.openWorld; |
93 Types types; | 98 Types types; |
94 _CompilerCoreTypes _coreTypes; | 99 _CompilerCoreTypes _coreTypes; |
95 CompilerDiagnosticReporter _reporter; | 100 CompilerDiagnosticReporter _reporter; |
96 _CompilerResolution _resolution; | 101 _CompilerResolution _resolution; |
97 ParsingContext _parsingContext; | 102 ParsingContext _parsingContext; |
98 | 103 |
99 final CacheStrategy cacheStrategy; | 104 final CacheStrategy cacheStrategy; |
100 | 105 |
101 ImpactStrategy impactStrategy = const ImpactStrategy(); | 106 ImpactStrategy impactStrategy = const ImpactStrategy(); |
102 | 107 |
(...skipping 29 matching lines...) Expand all Loading... |
132 | 137 |
133 Tracer tracer; | 138 Tracer tracer; |
134 | 139 |
135 LibraryElement mainApp; | 140 LibraryElement mainApp; |
136 FunctionElement mainFunction; | 141 FunctionElement mainFunction; |
137 | 142 |
138 DiagnosticReporter get reporter => _reporter; | 143 DiagnosticReporter get reporter => _reporter; |
139 CommonElements get commonElements => _coreTypes; | 144 CommonElements get commonElements => _coreTypes; |
140 CoreClasses get coreClasses => _coreTypes; | 145 CoreClasses get coreClasses => _coreTypes; |
141 CoreTypes get coreTypes => _coreTypes; | 146 CoreTypes get coreTypes => _coreTypes; |
142 CommonMasks get commonMasks => globalInference.masks; | |
143 Resolution get resolution => _resolution; | 147 Resolution get resolution => _resolution; |
144 ParsingContext get parsingContext => _parsingContext; | 148 ParsingContext get parsingContext => _parsingContext; |
145 | 149 |
146 // TODO(zarah): Remove this map and incorporate compile-time errors | 150 // TODO(zarah): Remove this map and incorporate compile-time errors |
147 // in the model. | 151 // in the model. |
148 /// Tracks elements with compile-time errors. | 152 /// Tracks elements with compile-time errors. |
149 final Map<Element, List<DiagnosticMessage>> elementsWithCompileTimeErrors = | 153 final Map<Element, List<DiagnosticMessage>> elementsWithCompileTimeErrors = |
150 new Map<Element, List<DiagnosticMessage>>(); | 154 new Map<Element, List<DiagnosticMessage>>(); |
151 | 155 |
152 final Environment environment; | 156 final Environment environment; |
(...skipping 24 matching lines...) Expand all Loading... |
177 ConstantEnvironment constants; | 181 ConstantEnvironment constants; |
178 | 182 |
179 EnqueueTask enqueuer; | 183 EnqueueTask enqueuer; |
180 DeferredLoadTask deferredLoadTask; | 184 DeferredLoadTask deferredLoadTask; |
181 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; | 185 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; |
182 DumpInfoTask dumpInfoTask; | 186 DumpInfoTask dumpInfoTask; |
183 | 187 |
184 /// A customizable filter that is applied to enqueued work items. | 188 /// A customizable filter that is applied to enqueued work items. |
185 QueueFilter enqueuerFilter = new QueueFilter(); | 189 QueueFilter enqueuerFilter = new QueueFilter(); |
186 | 190 |
187 bool enabledRuntimeType = false; | 191 bool get hasFunctionApplySupport => resolverWorld.hasFunctionApplySupport; |
188 bool enabledFunctionApply = false; | 192 bool get hasIsolateSupport => resolverWorld.hasIsolateSupport; |
189 bool enabledInvokeOn = false; | |
190 bool hasIsolateSupport = false; | |
191 | 193 |
192 bool get hasCrashed => _reporter.hasCrashed; | 194 bool get hasCrashed => _reporter.hasCrashed; |
193 | 195 |
194 Stopwatch progress; | 196 Stopwatch progress; |
195 | 197 |
196 bool get shouldPrintProgress { | 198 bool get shouldPrintProgress { |
197 return options.verbose && progress.elapsedMilliseconds > 500; | 199 return options.verbose && progress.elapsedMilliseconds > 500; |
198 } | 200 } |
199 | 201 |
200 static const int PHASE_SCANNING = 0; | 202 static const int PHASE_SCANNING = 0; |
201 static const int PHASE_RESOLVING = 1; | 203 static const int PHASE_RESOLVING = 1; |
202 static const int PHASE_DONE_RESOLVING = 2; | 204 static const int PHASE_DONE_RESOLVING = 2; |
203 static const int PHASE_COMPILING = 3; | 205 static const int PHASE_COMPILING = 3; |
204 int phase; | 206 int phase; |
205 | 207 |
206 bool compilationFailed = false; | 208 bool compilationFailed = false; |
207 | 209 |
208 Compiler( | 210 Compiler( |
209 {CompilerOptions options, | 211 {CompilerOptions options, |
210 api.CompilerOutput outputProvider, | 212 api.CompilerOutput outputProvider, |
211 this.environment: const _EmptyEnvironment(), | 213 this.environment: const _EmptyEnvironment(), |
212 MakeBackendFuncion makeBackend, | 214 MakeBackendFuncion makeBackend, |
213 MakeReporterFunction makeReporter}) | 215 MakeReporterFunction makeReporter}) |
214 : this.options = options, | 216 : this.options = options, |
215 this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport), | 217 this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport), |
216 this.userOutputProvider = outputProvider == null | 218 this.userOutputProvider = outputProvider == null |
217 ? const NullCompilerOutput() | 219 ? const NullCompilerOutput() |
218 : outputProvider { | 220 : outputProvider { |
219 _world = new WorldImpl(this); | |
220 if (makeReporter != null) { | 221 if (makeReporter != null) { |
221 _reporter = makeReporter(this, options); | 222 _reporter = makeReporter(this, options); |
222 } else { | 223 } else { |
223 _reporter = new CompilerDiagnosticReporter(this, options); | 224 _reporter = new CompilerDiagnosticReporter(this, options); |
224 } | 225 } |
225 _resolution = new _CompilerResolution(this); | 226 _resolution = new _CompilerResolution(this); |
226 // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and | 227 // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and |
227 // make its field final. | 228 // make its field final. |
228 _coreTypes = new _CompilerCoreTypes(_resolution, reporter); | 229 _coreTypes = new _CompilerCoreTypes(_resolution, reporter); |
229 types = new Types(_resolution); | 230 types = new Types(_resolution); |
(...skipping 11 matching lines...) Expand all Loading... |
241 backend = makeBackend(this); | 242 backend = makeBackend(this); |
242 } else { | 243 } else { |
243 js_backend.JavaScriptBackend jsBackend = new js_backend.JavaScriptBackend( | 244 js_backend.JavaScriptBackend jsBackend = new js_backend.JavaScriptBackend( |
244 this, | 245 this, |
245 generateSourceMap: options.generateSourceMap, | 246 generateSourceMap: options.generateSourceMap, |
246 useStartupEmitter: options.useStartupEmitter, | 247 useStartupEmitter: options.useStartupEmitter, |
247 useNewSourceInfo: options.useNewSourceInfo, | 248 useNewSourceInfo: options.useNewSourceInfo, |
248 useKernel: options.useKernel); | 249 useKernel: options.useKernel); |
249 backend = jsBackend; | 250 backend = jsBackend; |
250 } | 251 } |
| 252 enqueuer = backend.makeEnqueuer(); |
251 | 253 |
252 if (options.dumpInfo && options.useStartupEmitter) { | 254 if (options.dumpInfo && options.useStartupEmitter) { |
253 throw new ArgumentError( | 255 throw new ArgumentError( |
254 '--dump-info is not supported with the fast startup emitter'); | 256 '--dump-info is not supported with the fast startup emitter'); |
255 } | 257 } |
256 | 258 |
257 tasks = [ | 259 tasks = [ |
258 dietParser = | 260 dietParser = |
259 new DietParserTask(options, idGenerator, backend, reporter, measurer), | 261 new DietParserTask(options, idGenerator, backend, reporter, measurer), |
260 scanner = createScannerTask(), | 262 scanner = createScannerTask(), |
(...skipping 11 matching lines...) Expand all Loading... |
272 measurer), | 274 measurer), |
273 parser = new ParserTask(this, options), | 275 parser = new ParserTask(this, options), |
274 patchParser = new PatchParserTask(this, options), | 276 patchParser = new PatchParserTask(this, options), |
275 resolver = createResolverTask(), | 277 resolver = createResolverTask(), |
276 closureToClassMapper = new closureMapping.ClosureTask(this), | 278 closureToClassMapper = new closureMapping.ClosureTask(this), |
277 checker = new TypeCheckerTask(this), | 279 checker = new TypeCheckerTask(this), |
278 globalInference = new GlobalTypeInferenceTask(this), | 280 globalInference = new GlobalTypeInferenceTask(this), |
279 constants = backend.constantCompilerTask, | 281 constants = backend.constantCompilerTask, |
280 deferredLoadTask = new DeferredLoadTask(this), | 282 deferredLoadTask = new DeferredLoadTask(this), |
281 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 283 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
282 enqueuer = backend.makeEnqueuer(), | 284 // [enqueuer] is created earlier because it contains the resolution world |
| 285 // objects needed by other tasks. |
| 286 enqueuer, |
283 dumpInfoTask = new DumpInfoTask(this), | 287 dumpInfoTask = new DumpInfoTask(this), |
284 selfTask = new GenericTask('self', measurer), | 288 selfTask = new GenericTask('self', measurer), |
285 ]; | 289 ]; |
286 if (options.resolveOnly) { | 290 if (options.resolveOnly) { |
287 serialization.supportSerialization = true; | 291 serialization.supportSerialization = true; |
288 } | 292 } |
289 | 293 |
290 _parsingContext = | 294 _parsingContext = |
291 new ParsingContext(reporter, options, parser, patchParser, backend); | 295 new ParsingContext(reporter, options, parser, patchParser, backend); |
292 | 296 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 selfTask.measureSubtask("Compiler.compileLoadedLibraries", () { | 643 selfTask.measureSubtask("Compiler.compileLoadedLibraries", () { |
640 computeMain(); | 644 computeMain(); |
641 | 645 |
642 mirrorUsageAnalyzerTask.analyzeUsage(mainApp); | 646 mirrorUsageAnalyzerTask.analyzeUsage(mainApp); |
643 | 647 |
644 // In order to see if a library is deferred, we must compute the | 648 // In order to see if a library is deferred, we must compute the |
645 // compile-time constants that are metadata. This means adding | 649 // compile-time constants that are metadata. This means adding |
646 // something to the resolution queue. So we cannot wait with | 650 // something to the resolution queue. So we cannot wait with |
647 // this until after the resolution queue is processed. | 651 // this until after the resolution queue is processed. |
648 deferredLoadTask.beforeResolution(this); | 652 deferredLoadTask.beforeResolution(this); |
649 impactStrategy = backend.createImpactStrategy( | 653 ImpactStrategy impactStrategy = backend.createImpactStrategy( |
650 supportDeferredLoad: deferredLoadTask.isProgramSplit, | 654 supportDeferredLoad: deferredLoadTask.isProgramSplit, |
651 supportDumpInfo: options.dumpInfo, | 655 supportDumpInfo: options.dumpInfo, |
652 supportSerialization: serialization.supportSerialization); | 656 supportSerialization: serialization.supportSerialization); |
653 | 657 |
654 phase = PHASE_RESOLVING; | 658 phase = PHASE_RESOLVING; |
655 if (options.resolveOnly) { | 659 if (options.resolveOnly) { |
656 libraryLoader.libraries.where((LibraryElement library) { | 660 libraryLoader.libraries.where((LibraryElement library) { |
657 return !serialization.isDeserialized(library); | 661 return !serialization.isDeserialized(library); |
658 }).forEach((LibraryElement library) { | 662 }).forEach((LibraryElement library) { |
659 reporter.log('Enqueuing ${library.canonicalUri}'); | 663 reporter.log('Enqueuing ${library.canonicalUri}'); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 | 751 |
748 backend.sourceInformationStrategy.onComplete(); | 752 backend.sourceInformationStrategy.onComplete(); |
749 | 753 |
750 checkQueues(); | 754 checkQueues(); |
751 }); | 755 }); |
752 | 756 |
753 /// Perform the steps needed to fully end the resolution phase. | 757 /// Perform the steps needed to fully end the resolution phase. |
754 void closeResolution() { | 758 void closeResolution() { |
755 phase = PHASE_DONE_RESOLVING; | 759 phase = PHASE_DONE_RESOLVING; |
756 | 760 |
757 openWorld.closeWorld(); | 761 openWorld.closeWorld(reporter); |
758 // Compute whole-program-knowledge that the backend needs. (This might | 762 // Compute whole-program-knowledge that the backend needs. (This might |
759 // require the information computed in [world.closeWorld].) | 763 // require the information computed in [world.closeWorld].) |
760 backend.onResolutionComplete(); | 764 backend.onResolutionComplete(); |
761 | 765 |
762 deferredLoadTask.onResolutionComplete(mainFunction); | 766 deferredLoadTask.onResolutionComplete(mainFunction); |
763 | 767 |
764 // TODO(johnniwinther): Move this after rti computation but before | 768 // TODO(johnniwinther): Move this after rti computation but before |
765 // reflection members computation, and (re-)close the world afterwards. | 769 // reflection members computation, and (re-)close the world afterwards. |
766 closureToClassMapper.createClosureClasses(); | 770 closureToClassMapper.createClosureClasses(); |
767 } | 771 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 for (LibraryElement library in libraryLoader.libraries) { | 823 for (LibraryElement library in libraryLoader.libraries) { |
820 if (library.metadata != null) { | 824 if (library.metadata != null) { |
821 for (MetadataAnnotation metadata in library.metadata) { | 825 for (MetadataAnnotation metadata in library.metadata) { |
822 metadata.ensureResolved(resolution); | 826 metadata.ensureResolved(resolution); |
823 } | 827 } |
824 } | 828 } |
825 } | 829 } |
826 } | 830 } |
827 | 831 |
828 /** | 832 /** |
829 * Empty the [world] queue. | 833 * Empty the [enqueuer] queue. |
830 */ | 834 */ |
831 void emptyQueue(Enqueuer world) => | 835 void emptyQueue(Enqueuer enqueuer) { |
832 selfTask.measureSubtask("Compiler.emptyQueue", () { | 836 selfTask.measureSubtask("Compiler.emptyQueue", () { |
833 world.forEach((WorkItem work) { | 837 enqueuer.forEach((WorkItem work) { |
834 reporter.withCurrentElement( | 838 reporter.withCurrentElement( |
835 work.element, | 839 work.element, |
836 () => selfTask.measureSubtask("world.applyImpact", () { | 840 () => selfTask.measureSubtask("world.applyImpact", () { |
837 world.applyImpact( | 841 enqueuer.applyImpact( |
838 selfTask.measureSubtask( | 842 impactStrategy, |
839 "work.run", () => work.run(this, world)), | 843 selfTask.measureSubtask( |
840 impactSource: work.element); | 844 "work.run", () => work.run(this, enqueuer)), |
841 })); | 845 impactSource: work.element); |
842 }); | 846 })); |
843 }); | 847 }); |
| 848 }); |
| 849 } |
844 | 850 |
845 void processQueue(Enqueuer enqueuer, Element main) { | 851 void processQueue(Enqueuer enqueuer, Element main) { |
846 selfTask.measureSubtask("Compiler.processQueue", () { | 852 selfTask.measureSubtask("Compiler.processQueue", () { |
847 WorldImpactBuilderImpl nativeImpact = new WorldImpactBuilderImpl(); | 853 WorldImpactBuilderImpl nativeImpact = new WorldImpactBuilderImpl(); |
848 enqueuer.nativeEnqueuer | 854 enqueuer.nativeEnqueuer |
849 .processNativeClasses(nativeImpact, libraryLoader.libraries); | 855 .processNativeClasses(nativeImpact, libraryLoader.libraries); |
850 enqueuer.applyImpact(nativeImpact); | 856 enqueuer.applyImpact(impactStrategy, nativeImpact); |
851 if (main != null && !main.isMalformed) { | 857 if (main != null && !main.isMalformed) { |
852 FunctionElement mainMethod = main; | 858 FunctionElement mainMethod = main; |
853 mainMethod.computeType(resolution); | 859 mainMethod.computeType(resolution); |
854 if (mainMethod.functionSignature.parameterCount != 0) { | 860 if (mainMethod.functionSignature.parameterCount != 0) { |
855 // The first argument could be a list of strings. | 861 // The first argument could be a list of strings. |
856 backend.backendClasses.listImplementation.ensureResolved(resolution); | 862 backend.backendClasses.listImplementation.ensureResolved(resolution); |
857 enqueuer.registerInstantiatedType( | 863 enqueuer.registerInstantiatedType( |
858 backend.backendClasses.listImplementation.rawType); | 864 backend.backendClasses.listImplementation.rawType); |
859 backend.backendClasses.stringImplementation | 865 backend.backendClasses.stringImplementation |
860 .ensureResolved(resolution); | 866 .ensureResolved(resolution); |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 | 2037 |
2032 @override | 2038 @override |
2033 void ensureResolved(Element element) { | 2039 void ensureResolved(Element element) { |
2034 if (compiler.serialization.isDeserialized(element)) { | 2040 if (compiler.serialization.isDeserialized(element)) { |
2035 return; | 2041 return; |
2036 } | 2042 } |
2037 computeWorldImpact(element); | 2043 computeWorldImpact(element); |
2038 } | 2044 } |
2039 | 2045 |
2040 @override | 2046 @override |
| 2047 void ensureClassMembers(ClassElement element) { |
| 2048 if (!compiler.serialization.isDeserialized(element)) { |
| 2049 compiler.resolver.checkClass(element); |
| 2050 } |
| 2051 } |
| 2052 |
| 2053 @override |
2041 void registerCompileTimeError(Element element, DiagnosticMessage message) => | 2054 void registerCompileTimeError(Element element, DiagnosticMessage message) => |
2042 compiler.registerCompileTimeError(element, message); | 2055 compiler.registerCompileTimeError(element, message); |
2043 | 2056 |
2044 @override | 2057 @override |
2045 bool hasResolvedAst(ExecutableElement element) { | 2058 bool hasResolvedAst(ExecutableElement element) { |
2046 assert(invariant(element, element.isDeclaration, | 2059 assert(invariant(element, element.isDeclaration, |
2047 message: "Element $element must be the declaration.")); | 2060 message: "Element $element must be the declaration.")); |
2048 if (compiler.serialization.isDeserialized(element)) { | 2061 if (compiler.serialization.isDeserialized(element)) { |
2049 return compiler.serialization.hasResolvedAst(element); | 2062 return compiler.serialization.hasResolvedAst(element); |
2050 } | 2063 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2131 compiler.checker.check(element); | 2144 compiler.checker.check(element); |
2132 } | 2145 } |
2133 return transformResolutionImpact(element, resolutionImpact); | 2146 return transformResolutionImpact(element, resolutionImpact); |
2134 }); | 2147 }); |
2135 } | 2148 } |
2136 | 2149 |
2137 @override | 2150 @override |
2138 WorldImpact transformResolutionImpact( | 2151 WorldImpact transformResolutionImpact( |
2139 Element element, ResolutionImpact resolutionImpact) { | 2152 Element element, ResolutionImpact resolutionImpact) { |
2140 WorldImpact worldImpact = compiler.backend.impactTransformer | 2153 WorldImpact worldImpact = compiler.backend.impactTransformer |
2141 .transformResolutionImpact(compiler.enqueuer.resolution, resolutionImpac
t); | 2154 .transformResolutionImpact( |
| 2155 compiler.enqueuer.resolution, resolutionImpact); |
2142 _worldImpactCache[element] = worldImpact; | 2156 _worldImpactCache[element] = worldImpact; |
2143 return worldImpact; | 2157 return worldImpact; |
2144 } | 2158 } |
2145 | 2159 |
2146 @override | 2160 @override |
2147 void uncacheWorldImpact(Element element) { | 2161 void uncacheWorldImpact(Element element) { |
2148 assert(invariant(element, element.isDeclaration, | 2162 assert(invariant(element, element.isDeclaration, |
2149 message: "Element $element must be the declaration.")); | 2163 message: "Element $element must be the declaration.")); |
2150 if (retainCachesForTesting) return; | 2164 if (retainCachesForTesting) return; |
2151 if (compiler.serialization.isDeserialized(element)) return; | 2165 if (compiler.serialization.isDeserialized(element)) return; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2244 _ElementScanner(this.scanner); | 2258 _ElementScanner(this.scanner); |
2245 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2259 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2246 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2260 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2247 } | 2261 } |
2248 | 2262 |
2249 class _EmptyEnvironment implements Environment { | 2263 class _EmptyEnvironment implements Environment { |
2250 const _EmptyEnvironment(); | 2264 const _EmptyEnvironment(); |
2251 | 2265 |
2252 String valueOf(String key) => null; | 2266 String valueOf(String key) => null; |
2253 } | 2267 } |
OLD | NEW |