| 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 '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
| 10 show NullSink; | 10 show NullSink; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 Expando<MemorySourceFileProvider> expando = | 77 Expando<MemorySourceFileProvider> expando = |
| 78 new Expando<MemorySourceFileProvider>(); | 78 new Expando<MemorySourceFileProvider>(); |
| 79 | 79 |
| 80 Compiler compilerFor(Map<String,String> memorySourceFiles, | 80 Compiler compilerFor(Map<String,String> memorySourceFiles, |
| 81 {DiagnosticHandler diagnosticHandler, | 81 {DiagnosticHandler diagnosticHandler, |
| 82 List<String> options: const [], | 82 List<String> options: const [], |
| 83 Compiler cachedCompiler, | 83 Compiler cachedCompiler, |
| 84 bool showDiagnostics: true, | 84 bool showDiagnostics: true, |
| 85 Uri packageRoot}) { | 85 Uri packageRoot}) { |
| 86 Uri script = currentDirectory.resolveUri(Platform.script); | 86 Uri libraryRoot = Uri.base.resolve('sdk/'); |
| 87 Uri libraryRoot = script.resolve('../../../sdk/'); | 87 Uri script = Uri.base.resolveUri(Platform.script); |
| 88 if (packageRoot == null) { | 88 if (packageRoot == null) { |
| 89 packageRoot = currentDirectory.resolve( | 89 packageRoot = Uri.base.resolve('${Platform.packageRoot}/'); |
| 90 appendSlash(nativeToUriPath(Platform.packageRoot))); | |
| 91 } | 90 } |
| 92 | 91 |
| 93 MemorySourceFileProvider provider; | 92 MemorySourceFileProvider provider; |
| 94 var readStringFromUri; | 93 var readStringFromUri; |
| 95 if (cachedCompiler == null) { | 94 if (cachedCompiler == null) { |
| 96 provider = new MemorySourceFileProvider(memorySourceFiles); | 95 provider = new MemorySourceFileProvider(memorySourceFiles); |
| 97 readStringFromUri = provider.readStringFromUri; | 96 readStringFromUri = provider.readStringFromUri; |
| 98 // Saving the provider in case we need it later for a cached compiler. | 97 // Saving the provider in case we need it later for a cached compiler. |
| 99 expando[readStringFromUri] = provider; | 98 expando[readStringFromUri] = provider; |
| 100 } else { | 99 } else { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 150 } |
| 152 }); | 151 }); |
| 153 } | 152 } |
| 154 return compiler; | 153 return compiler; |
| 155 } | 154 } |
| 156 | 155 |
| 157 Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles, | 156 Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles, |
| 158 {DiagnosticHandler diagnosticHandler, | 157 {DiagnosticHandler diagnosticHandler, |
| 159 List<String> options: const [], | 158 List<String> options: const [], |
| 160 bool showDiagnostics: true}) { | 159 bool showDiagnostics: true}) { |
| 161 Uri script = currentDirectory.resolveUri(Platform.script); | 160 Uri libraryRoot = Uri.base.resolve('sdk/'); |
| 162 Uri libraryRoot = script.resolve('../../../sdk/'); | 161 Uri packageRoot = Uri.base.resolve('${Platform.packageRoot}/'); |
| 163 Uri packageRoot = script.resolve('./packages/'); | 162 Uri script = Uri.base.resolveUri(Platform.script); |
| 164 | 163 |
| 165 var provider = new MemorySourceFileProvider(memorySourceFiles); | 164 var provider = new MemorySourceFileProvider(memorySourceFiles); |
| 166 var handler = | 165 var handler = |
| 167 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 166 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 168 | 167 |
| 169 List<Uri> libraries = <Uri>[]; | 168 List<Uri> libraries = <Uri>[]; |
| 170 memorySourceFiles.forEach((String path, _) { | 169 memorySourceFiles.forEach((String path, _) { |
| 171 libraries.add(new Uri(scheme: 'memory', path: path)); | 170 libraries.add(new Uri(scheme: 'memory', path: path)); |
| 172 }); | 171 }); |
| 173 | 172 |
| 174 return analyze(libraries, libraryRoot, packageRoot, | 173 return analyze(libraries, libraryRoot, packageRoot, |
| 175 provider, handler, options); | 174 provider, handler, options); |
| 176 } | 175 } |
| OLD | NEW |