OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.test.memory_compiler; | 5 library dart2js.test.memory_compiler; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:compiler/compiler.dart' show DiagnosticHandler; | 9 import 'package:compiler/compiler.dart' show DiagnosticHandler; |
10 import 'package:compiler/compiler_new.dart' | 10 import 'package:compiler/compiler_new.dart' |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 }); | 177 }); |
178 // TODO(johnniwinther): Assert that no libraries are loaded lazily from | 178 // TODO(johnniwinther): Assert that no libraries are loaded lazily from |
179 // this call. | 179 // this call. |
180 compiler.onLibrariesLoaded(new MemoryLoadedLibraries(copiedLibraries)); | 180 compiler.onLibrariesLoaded(new MemoryLoadedLibraries(copiedLibraries)); |
181 | 181 |
182 compiler.backend.constantCompilerTask | 182 compiler.backend.constantCompilerTask |
183 .copyConstantValues(cachedCompiler.backend.constantCompilerTask); | 183 .copyConstantValues(cachedCompiler.backend.constantCompilerTask); |
184 | 184 |
185 Iterable cachedTreeElements = | 185 Iterable cachedTreeElements = |
186 cachedCompiler.enqueuer.resolution.processedElements; | 186 cachedCompiler.enqueuer.resolution.processedEntities; |
187 cachedTreeElements.forEach((element) { | 187 cachedTreeElements.forEach((element) { |
188 if (element.library.isPlatformLibrary) { | 188 if (element.library.isPlatformLibrary) { |
189 compiler.enqueuer.resolution.registerProcessedElement(element); | 189 compiler.enqueuer.resolution.registerProcessedElement(element); |
190 } | 190 } |
191 }); | 191 }); |
192 | 192 |
193 // One potential problem that can occur when reusing elements is that there | 193 // One potential problem that can occur when reusing elements is that there |
194 // is a stale reference to an old compiler object. By nulling out the old | 194 // is a stale reference to an old compiler object. By nulling out the old |
195 // compiler's fields, such stale references are easier to identify. | 195 // compiler's fields, such stale references are easier to identify. |
196 cachedCompiler.scanner = null; | 196 cachedCompiler.scanner = null; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) { | 244 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) { |
245 diagnosticHandler(uri, begin, end, message, kind); | 245 diagnosticHandler(uri, begin, end, message, kind); |
246 formattingHandler(uri, begin, end, message, kind); | 246 formattingHandler(uri, begin, end, message, kind); |
247 }; | 247 }; |
248 } | 248 } |
249 } else if (diagnosticHandler == null) { | 249 } else if (diagnosticHandler == null) { |
250 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; | 250 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; |
251 } | 251 } |
252 return handler; | 252 return handler; |
253 } | 253 } |
OLD | NEW |