| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 | 9 import 'package:compiler/compiler.dart' show |
| 10 DiagnosticHandler; | 10 DiagnosticHandler; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 List<String> options: const <String>[], | 108 List<String> options: const <String>[], |
| 109 CompilerImpl cachedCompiler, | 109 CompilerImpl cachedCompiler, |
| 110 bool showDiagnostics: true, | 110 bool showDiagnostics: true, |
| 111 Uri packageRoot, | 111 Uri packageRoot, |
| 112 Uri packageConfig, | 112 Uri packageConfig, |
| 113 PackagesDiscoveryProvider packagesDiscoveryProvider}) { | 113 PackagesDiscoveryProvider packagesDiscoveryProvider}) { |
| 114 Uri libraryRoot = Uri.base.resolve('sdk/'); | 114 Uri libraryRoot = Uri.base.resolve('sdk/'); |
| 115 if (packageRoot == null && | 115 if (packageRoot == null && |
| 116 packageConfig == null && | 116 packageConfig == null && |
| 117 packagesDiscoveryProvider == null) { | 117 packagesDiscoveryProvider == null) { |
| 118 packageRoot = Uri.base.resolveUri(Uri.parse(Platform.packageRoot)); | 118 packageRoot = Uri.base.resolve(Platform.packageRoot); |
| 119 } | 119 } |
| 120 | 120 |
| 121 MemorySourceFileProvider provider; | 121 MemorySourceFileProvider provider; |
| 122 if (cachedCompiler == null) { | 122 if (cachedCompiler == null) { |
| 123 provider = new MemorySourceFileProvider(memorySourceFiles); | 123 provider = new MemorySourceFileProvider(memorySourceFiles); |
| 124 // Saving the provider in case we need it later for a cached compiler. | 124 // Saving the provider in case we need it later for a cached compiler. |
| 125 expando[provider] = provider; | 125 expando[provider] = provider; |
| 126 } else { | 126 } else { |
| 127 // When using a cached compiler, it has read a number of files from disk | 127 // When using a cached compiler, it has read a number of files from disk |
| 128 // already (and will not attempt to read them again due to caching). These | 128 // already (and will not attempt to read them again due to caching). These |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 273 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 274 | 274 |
| 275 List<Uri> libraries = <Uri>[]; | 275 List<Uri> libraries = <Uri>[]; |
| 276 memorySourceFiles.forEach((String path, _) { | 276 memorySourceFiles.forEach((String path, _) { |
| 277 libraries.add(new Uri(scheme: 'memory', path: path)); | 277 libraries.add(new Uri(scheme: 'memory', path: path)); |
| 278 }); | 278 }); |
| 279 | 279 |
| 280 return analyze(libraries, libraryRoot, packageRoot, | 280 return analyze(libraries, libraryRoot, packageRoot, |
| 281 provider, handler, options); | 281 provider, handler, options); |
| 282 } | 282 } |
| OLD | NEW |