| 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 'memory_source_file_helper.dart'; | 7 import 'memory_source_file_helper.dart'; |
| 8 | 8 |
| 9 import 'package:compiler/implementation/dart2jslib.dart' | 9 import 'package:compiler/implementation/dart2jslib.dart' |
| 10 show NullSink; | 10 show NullSink; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 new Expando<MemorySourceFileProvider>(); | 118 new Expando<MemorySourceFileProvider>(); |
| 119 | 119 |
| 120 Compiler compilerFor(Map<String,String> memorySourceFiles, | 120 Compiler compilerFor(Map<String,String> memorySourceFiles, |
| 121 {DiagnosticHandler diagnosticHandler, | 121 {DiagnosticHandler diagnosticHandler, |
| 122 CompilerOutputProvider outputProvider, | 122 CompilerOutputProvider outputProvider, |
| 123 List<String> options: const [], | 123 List<String> options: const [], |
| 124 Compiler cachedCompiler, | 124 Compiler cachedCompiler, |
| 125 bool showDiagnostics: true, | 125 bool showDiagnostics: true, |
| 126 Uri packageRoot}) { | 126 Uri packageRoot}) { |
| 127 Uri libraryRoot = Uri.base.resolve('sdk/'); | 127 Uri libraryRoot = Uri.base.resolve('sdk/'); |
| 128 Uri script = Uri.base.resolveUri(Platform.script); | |
| 129 if (packageRoot == null) { | 128 if (packageRoot == null) { |
| 130 packageRoot = Uri.base.resolveUri(new Uri.file('${Platform.packageRoot}/')); | 129 packageRoot = Uri.base.resolveUri(new Uri.file('${Platform.packageRoot}/')); |
| 131 } | 130 } |
| 132 | 131 |
| 133 MemorySourceFileProvider provider; | 132 MemorySourceFileProvider provider; |
| 134 var readStringFromUri; | 133 var readStringFromUri; |
| 135 if (cachedCompiler == null) { | 134 if (cachedCompiler == null) { |
| 136 provider = new MemorySourceFileProvider(memorySourceFiles); | 135 provider = new MemorySourceFileProvider(memorySourceFiles); |
| 137 readStringFromUri = provider.readStringFromUri; | 136 readStringFromUri = provider.readStringFromUri; |
| 138 // Saving the provider in case we need it later for a cached compiler. | 137 // Saving the provider in case we need it later for a cached compiler. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return compiler; | 230 return compiler; |
| 232 } | 231 } |
| 233 | 232 |
| 234 Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles, | 233 Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles, |
| 235 {DiagnosticHandler diagnosticHandler, | 234 {DiagnosticHandler diagnosticHandler, |
| 236 List<String> options: const [], | 235 List<String> options: const [], |
| 237 bool showDiagnostics: true}) { | 236 bool showDiagnostics: true}) { |
| 238 Uri libraryRoot = Uri.base.resolve('sdk/'); | 237 Uri libraryRoot = Uri.base.resolve('sdk/'); |
| 239 Uri packageRoot = Uri.base.resolveUri( | 238 Uri packageRoot = Uri.base.resolveUri( |
| 240 new Uri.file('${Platform.packageRoot}/')); | 239 new Uri.file('${Platform.packageRoot}/')); |
| 241 Uri script = Uri.base.resolveUri(Platform.script); | |
| 242 | 240 |
| 243 var provider = new MemorySourceFileProvider(memorySourceFiles); | 241 var provider = new MemorySourceFileProvider(memorySourceFiles); |
| 244 var handler = | 242 var handler = |
| 245 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 243 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 246 | 244 |
| 247 List<Uri> libraries = <Uri>[]; | 245 List<Uri> libraries = <Uri>[]; |
| 248 memorySourceFiles.forEach((String path, _) { | 246 memorySourceFiles.forEach((String path, _) { |
| 249 libraries.add(new Uri(scheme: 'memory', path: path)); | 247 libraries.add(new Uri(scheme: 'memory', path: path)); |
| 250 }); | 248 }); |
| 251 | 249 |
| 252 return analyze(libraries, libraryRoot, packageRoot, | 250 return analyze(libraries, libraryRoot, packageRoot, |
| 253 provider, handler, options); | 251 provider, handler, options); |
| 254 } | 252 } |
| OLD | NEW |