| 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' |
| 11 show | 11 show |
| 12 CompilationResult, | 12 CompilationResult, |
| 13 CompilerDiagnostics, | 13 CompilerDiagnostics, |
| 14 CompilerOutput, | 14 CompilerOutput, |
| 15 Diagnostic, | 15 Diagnostic, |
| 16 PackagesDiscoveryProvider; | 16 PackagesDiscoveryProvider; |
| 17 import 'package:compiler/src/diagnostics/messages.dart' show Message; | 17 import 'package:compiler/src/diagnostics/messages.dart' show Message; |
| 18 import 'package:compiler/src/elements/entities.dart' | 18 import 'package:compiler/src/elements/entities.dart' |
| 19 show LibraryEntity, MemberEntity; | 19 show LibraryEntity, MemberEntity; |
| 20 import 'package:compiler/src/elements/resolution_types.dart' show Types; | |
| 21 import 'package:compiler/src/enqueue.dart' show ResolutionEnqueuer; | 20 import 'package:compiler/src/enqueue.dart' show ResolutionEnqueuer; |
| 22 import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput; | 21 import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput; |
| 23 import 'package:compiler/src/library_loader.dart' show LoadedLibraries; | 22 import 'package:compiler/src/library_loader.dart' show LoadedLibraries; |
| 24 import 'package:compiler/src/options.dart' show CompilerOptions; | 23 import 'package:compiler/src/options.dart' show CompilerOptions; |
| 25 | 24 |
| 26 import 'memory_source_file_helper.dart'; | 25 import 'memory_source_file_helper.dart'; |
| 27 | 26 |
| 28 export 'output_collector.dart'; | 27 export 'output_collector.dart'; |
| 29 export 'package:compiler/compiler_new.dart' show CompilationResult; | 28 export 'package:compiler/compiler_new.dart' show CompilationResult; |
| 30 export 'diagnostic_helper.dart'; | 29 export 'diagnostic_helper.dart'; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 entryPoint: entryPoint, | 165 entryPoint: entryPoint, |
| 167 resolutionInputs: resolutionInputs, | 166 resolutionInputs: resolutionInputs, |
| 168 libraryRoot: libraryRoot, | 167 libraryRoot: libraryRoot, |
| 169 packageRoot: packageRoot, | 168 packageRoot: packageRoot, |
| 170 options: options, | 169 options: options, |
| 171 environment: {}, | 170 environment: {}, |
| 172 packageConfig: packageConfig, | 171 packageConfig: packageConfig, |
| 173 packagesDiscoveryProvider: packagesDiscoveryProvider)); | 172 packagesDiscoveryProvider: packagesDiscoveryProvider)); |
| 174 | 173 |
| 175 if (cachedCompiler != null) { | 174 if (cachedCompiler != null) { |
| 176 Types types = cachedCompiler.types; | |
| 177 compiler.types = types.copy(compiler.resolution); | |
| 178 Map copiedLibraries = {}; | 175 Map copiedLibraries = {}; |
| 179 cachedCompiler.libraryLoader.libraries.forEach((dynamic library) { | 176 cachedCompiler.libraryLoader.libraries.forEach((dynamic library) { |
| 180 if (library.isPlatformLibrary) { | 177 if (library.isPlatformLibrary) { |
| 181 dynamic libraryLoader = compiler.libraryLoader; | 178 dynamic libraryLoader = compiler.libraryLoader; |
| 182 libraryLoader.mapLibrary(library); | 179 libraryLoader.mapLibrary(library); |
| 183 copiedLibraries[library.canonicalUri] = library; | 180 copiedLibraries[library.canonicalUri] = library; |
| 184 } | 181 } |
| 185 }); | 182 }); |
| 186 compiler.processLoadedLibraries(new MemoryLoadedLibraries(copiedLibraries)); | 183 compiler.processLoadedLibraries(new MemoryLoadedLibraries(copiedLibraries)); |
| 187 ResolutionEnqueuer resolutionEnqueuer = compiler.startResolution(); | 184 ResolutionEnqueuer resolutionEnqueuer = compiler.startResolution(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) { | 249 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) { |
| 253 diagnosticHandler(uri, begin, end, message, kind); | 250 diagnosticHandler(uri, begin, end, message, kind); |
| 254 formattingHandler(uri, begin, end, message, kind); | 251 formattingHandler(uri, begin, end, message, kind); |
| 255 }; | 252 }; |
| 256 } | 253 } |
| 257 } else if (diagnosticHandler == null) { | 254 } else if (diagnosticHandler == null) { |
| 258 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; | 255 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; |
| 259 } | 256 } |
| 260 return handler; | 257 return handler; |
| 261 } | 258 } |
| OLD | NEW |