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 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 // cache [ResolutionImpact] and let the enqueuer transform it into | 2015 // cache [ResolutionImpact] and let the enqueuer transform it into |
2016 // a [WorldImpact]. | 2016 // a [WorldImpact]. |
2017 _resolutionImpactCache[element] = resolutionImpact; | 2017 _resolutionImpactCache[element] = resolutionImpact; |
2018 } | 2018 } |
2019 if (tree != null && !compiler.options.analyzeSignaturesOnly) { | 2019 if (tree != null && !compiler.options.analyzeSignaturesOnly) { |
2020 // TODO(het): don't do this if suppressWarnings is on, currently we have | 2020 // TODO(het): don't do this if suppressWarnings is on, currently we have |
2021 // to do it because the typechecker also sets types | 2021 // to do it because the typechecker also sets types |
2022 // Only analyze nodes with a corresponding [TreeElements]. | 2022 // Only analyze nodes with a corresponding [TreeElements]. |
2023 compiler.checker.check(element); | 2023 compiler.checker.check(element); |
2024 } | 2024 } |
2025 WorldImpact worldImpact = compiler.backend.impactTransformer | 2025 return transformResolutionImpact(element, resolutionImpact); |
2026 .transformResolutionImpact(resolutionImpact); | |
2027 return worldImpact; | |
2028 }); | 2026 }); |
2029 } | 2027 } |
2030 | 2028 |
2031 @override | 2029 @override |
| 2030 WorldImpact transformResolutionImpact( |
| 2031 Element element, ResolutionImpact resolutionImpact) { |
| 2032 WorldImpact worldImpact = compiler.backend.impactTransformer |
| 2033 .transformResolutionImpact(resolutionImpact); |
| 2034 _worldImpactCache[element] = worldImpact; |
| 2035 return worldImpact; |
| 2036 } |
| 2037 |
| 2038 @override |
2032 void uncacheWorldImpact(Element element) { | 2039 void uncacheWorldImpact(Element element) { |
2033 assert(invariant(element, element.isDeclaration, | 2040 assert(invariant(element, element.isDeclaration, |
2034 message: "Element $element must be the declaration.")); | 2041 message: "Element $element must be the declaration.")); |
2035 if (retainCachesForTesting) return; | 2042 if (retainCachesForTesting) return; |
2036 if (compiler.serialization.isDeserialized(element)) return; | 2043 if (compiler.serialization.isDeserialized(element)) return; |
2037 assert(invariant(element, _worldImpactCache[element] != null, | 2044 assert(invariant(element, _worldImpactCache[element] != null, |
2038 message: "WorldImpact not computed for $element.")); | 2045 message: "WorldImpact not computed for $element.")); |
2039 _worldImpactCache[element] = const WorldImpact(); | 2046 _worldImpactCache[element] = const WorldImpact(); |
2040 _resolutionImpactCache.remove(element); | 2047 _resolutionImpactCache.remove(element); |
2041 } | 2048 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 _ElementScanner(this.scanner); | 2116 _ElementScanner(this.scanner); |
2110 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2117 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2111 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2118 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2112 } | 2119 } |
2113 | 2120 |
2114 class _EmptyEnvironment implements Environment { | 2121 class _EmptyEnvironment implements Environment { |
2115 const _EmptyEnvironment(); | 2122 const _EmptyEnvironment(); |
2116 | 2123 |
2117 String valueOf(String key) => null; | 2124 String valueOf(String key) => null; |
2118 } | 2125 } |
OLD | NEW |