| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 bool showDiagnostics: true}) { | 81 bool showDiagnostics: true}) { |
| 82 Uri script = currentDirectory.resolve(nativeToUriPath(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 != '' && name != 'precompiled') { |
| 92 throw 'Attempt to output file "$name.$extension"'; |
| 93 } |
| 92 return new NullSink('$name.$extension'); | 94 return new NullSink('$name.$extension'); |
| 93 } | 95 } |
| 94 | 96 |
| 95 Compiler compiler = new Compiler(provider.readStringFromUri, | 97 Compiler compiler = new Compiler(provider.readStringFromUri, |
| 96 outputProvider, | 98 outputProvider, |
| 97 handler, | 99 handler, |
| 98 libraryRoot, | 100 libraryRoot, |
| 99 packageRoot, | 101 packageRoot, |
| 100 options); | 102 options); |
| 101 if (cachedCompiler != null) { | 103 if (cachedCompiler != null) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 147 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 146 | 148 |
| 147 List<Uri> libraries = <Uri>[]; | 149 List<Uri> libraries = <Uri>[]; |
| 148 memorySourceFiles.forEach((String path, _) { | 150 memorySourceFiles.forEach((String path, _) { |
| 149 libraries.add(new Uri(scheme: 'memory', path: path)); | 151 libraries.add(new Uri(scheme: 'memory', path: path)); |
| 150 }); | 152 }); |
| 151 | 153 |
| 152 return analyze(libraries, libraryRoot, packageRoot, | 154 return analyze(libraries, libraryRoot, packageRoot, |
| 153 provider, handler, options); | 155 provider, handler, options); |
| 154 } | 156 } |
| OLD | NEW |