| 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; |
| 20 import 'package:compiler/src/enqueue.dart' show ResolutionEnqueuer; | 21 import 'package:compiler/src/enqueue.dart' show ResolutionEnqueuer; |
| 21 import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput; | 22 import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput; |
| 22 import 'package:compiler/src/library_loader.dart' show LoadedLibraries; | 23 import 'package:compiler/src/library_loader.dart' show LoadedLibraries; |
| 23 import 'package:compiler/src/options.dart' show CompilerOptions; | 24 import 'package:compiler/src/options.dart' show CompilerOptions; |
| 24 | 25 |
| 25 import 'memory_source_file_helper.dart'; | 26 import 'memory_source_file_helper.dart'; |
| 26 | 27 |
| 27 export 'output_collector.dart'; | 28 export 'output_collector.dart'; |
| 28 export 'package:compiler/compiler_new.dart' show CompilationResult; | 29 export 'package:compiler/compiler_new.dart' show CompilationResult; |
| 29 export 'diagnostic_helper.dart'; | 30 export 'diagnostic_helper.dart'; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 entryPoint: entryPoint, | 163 entryPoint: entryPoint, |
| 163 resolutionInputs: resolutionInputs, | 164 resolutionInputs: resolutionInputs, |
| 164 libraryRoot: libraryRoot, | 165 libraryRoot: libraryRoot, |
| 165 packageRoot: packageRoot, | 166 packageRoot: packageRoot, |
| 166 options: options, | 167 options: options, |
| 167 environment: {}, | 168 environment: {}, |
| 168 packageConfig: packageConfig, | 169 packageConfig: packageConfig, |
| 169 packagesDiscoveryProvider: packagesDiscoveryProvider)); | 170 packagesDiscoveryProvider: packagesDiscoveryProvider)); |
| 170 | 171 |
| 171 if (cachedCompiler != null) { | 172 if (cachedCompiler != null) { |
| 172 compiler.types = cachedCompiler.types.copy(compiler.resolution); | 173 Types types = cachedCompiler.types; |
| 174 compiler.types = types.copy(compiler.resolution); |
| 173 Map copiedLibraries = {}; | 175 Map copiedLibraries = {}; |
| 174 cachedCompiler.libraryLoader.libraries.forEach((library) { | 176 cachedCompiler.libraryLoader.libraries.forEach((library) { |
| 175 if (library.isPlatformLibrary) { | 177 if (library.isPlatformLibrary) { |
| 176 var libraryLoader = compiler.libraryLoader; | 178 var libraryLoader = compiler.libraryLoader; |
| 177 libraryLoader.mapLibrary(library); | 179 libraryLoader.mapLibrary(library); |
| 178 copiedLibraries[library.canonicalUri] = library; | 180 copiedLibraries[library.canonicalUri] = library; |
| 179 } | 181 } |
| 180 }); | 182 }); |
| 181 compiler.processLoadedLibraries(new MemoryLoadedLibraries(copiedLibraries)); | 183 compiler.processLoadedLibraries(new MemoryLoadedLibraries(copiedLibraries)); |
| 182 ResolutionEnqueuer resolutionEnqueuer = compiler.startResolution(); | 184 ResolutionEnqueuer resolutionEnqueuer = compiler.startResolution(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) { | 250 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) { |
| 249 diagnosticHandler(uri, begin, end, message, kind); | 251 diagnosticHandler(uri, begin, end, message, kind); |
| 250 formattingHandler(uri, begin, end, message, kind); | 252 formattingHandler(uri, begin, end, message, kind); |
| 251 }; | 253 }; |
| 252 } | 254 } |
| 253 } else if (diagnosticHandler == null) { | 255 } else if (diagnosticHandler == null) { |
| 254 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; | 256 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; |
| 255 } | 257 } |
| 256 return handler; | 258 return handler; |
| 257 } | 259 } |
| OLD | NEW |