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