| 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 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import 'memory_source_file_helper.dart'; | 8 import 'memory_source_file_helper.dart'; |
| 9 | 9 |
| 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; | 72 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; |
| 73 } | 73 } |
| 74 return handler; | 74 return handler; |
| 75 } | 75 } |
| 76 | 76 |
| 77 Compiler compilerFor(Map<String,String> memorySourceFiles, | 77 Compiler compilerFor(Map<String,String> memorySourceFiles, |
| 78 {DiagnosticHandler diagnosticHandler, | 78 {DiagnosticHandler diagnosticHandler, |
| 79 List<String> options: const [], | 79 List<String> options: const [], |
| 80 Compiler cachedCompiler, | 80 Compiler cachedCompiler, |
| 81 bool showDiagnostics: true}) { | 81 bool showDiagnostics: true}) { |
| 82 Uri script = currentDirectory.resolveUri(Platform.script); | 82 Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script)); |
| 83 Uri libraryRoot = script.resolve('../../../sdk/'); | 83 Uri libraryRoot = script.resolve('../../../sdk/'); |
| 84 Uri packageRoot = script.resolve('./packages/'); | 84 Uri packageRoot = script.resolve('./packages/'); |
| 85 | 85 |
| 86 var provider = new MemorySourceFileProvider(memorySourceFiles); | 86 var provider = new MemorySourceFileProvider(memorySourceFiles); |
| 87 var handler = | 87 var handler = |
| 88 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 88 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 89 | 89 |
| 90 EventSink<String> outputProvider(String name, String extension) { | 90 EventSink<String> outputProvider(String name, String extension) { |
| 91 if (name != '') throw 'Attempt to output file "$name.$extension"'; | 91 if (name != '') throw 'Attempt to output file "$name.$extension"'; |
| 92 return new NullSink('$name.$extension'); | 92 return new NullSink('$name.$extension'); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 }); | 130 }); |
| 131 } | 131 } |
| 132 return compiler; | 132 return compiler; |
| 133 } | 133 } |
| 134 | 134 |
| 135 Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles, | 135 Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles, |
| 136 {DiagnosticHandler diagnosticHandler, | 136 {DiagnosticHandler diagnosticHandler, |
| 137 List<String> options: const [], | 137 List<String> options: const [], |
| 138 bool showDiagnostics: true}) { | 138 bool showDiagnostics: true}) { |
| 139 Uri script = currentDirectory.resolveUri(Platform.script); | 139 Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script)); |
| 140 Uri libraryRoot = script.resolve('../../../sdk/'); | 140 Uri libraryRoot = script.resolve('../../../sdk/'); |
| 141 Uri packageRoot = script.resolve('./packages/'); | 141 Uri packageRoot = script.resolve('./packages/'); |
| 142 | 142 |
| 143 var provider = new MemorySourceFileProvider(memorySourceFiles); | 143 var provider = new MemorySourceFileProvider(memorySourceFiles); |
| 144 var handler = | 144 var handler = |
| 145 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 145 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 146 | 146 |
| 147 List<Uri> libraries = <Uri>[]; | 147 List<Uri> libraries = <Uri>[]; |
| 148 memorySourceFiles.forEach((String path, _) { | 148 memorySourceFiles.forEach((String path, _) { |
| 149 libraries.add(new Uri(scheme: 'memory', path: path)); | 149 libraries.add(new Uri(scheme: 'memory', path: path)); |
| 150 }); | 150 }); |
| 151 | 151 |
| 152 return analyze(libraries, libraryRoot, packageRoot, | 152 return analyze(libraries, libraryRoot, packageRoot, |
| 153 provider, handler, options); | 153 provider, handler, options); |
| 154 } | 154 } |
| OLD | NEW |