| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 provider = new MemorySourceFileProvider(memorySourceFiles); | 96 provider = new MemorySourceFileProvider(memorySourceFiles); |
| 97 readStringFromUri = provider.readStringFromUri; | 97 readStringFromUri = provider.readStringFromUri; |
| 98 // Saving the provider in case we need it later for a cached compiler. | 98 // Saving the provider in case we need it later for a cached compiler. |
| 99 expando[readStringFromUri] = provider; | 99 expando[readStringFromUri] = provider; |
| 100 } else { | 100 } else { |
| 101 // When using a cached compiler, it has read a number of files from disk | 101 // When using a cached compiler, it has read a number of files from disk |
| 102 // already (and will not attemp to read them again due to caching). These | 102 // already (and will not attemp to read them again due to caching). These |
| 103 // files must be available to the new diagnostic handler. | 103 // files must be available to the new diagnostic handler. |
| 104 provider = expando[cachedCompiler.provider]; | 104 provider = expando[cachedCompiler.provider]; |
| 105 readStringFromUri = cachedCompiler.provider; | 105 readStringFromUri = cachedCompiler.provider; |
| 106 provider.memorySourceFiles.clear(); | 106 provider.memorySourceFiles = memorySourceFiles; |
| 107 memorySourceFiles.forEach((key, value) { | |
| 108 provider.memorySourceFiles[key] = value; | |
| 109 }); | |
| 110 } | 107 } |
| 111 var handler = | 108 var handler = |
| 112 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 109 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 113 | 110 |
| 114 EventSink<String> outputProvider(String name, String extension) { | 111 EventSink<String> outputProvider(String name, String extension) { |
| 115 if (name != '') throw 'Attempt to output file "$name.$extension"'; | 112 if (name != '') throw 'Attempt to output file "$name.$extension"'; |
| 116 return new NullSink('$name.$extension'); | 113 return new NullSink('$name.$extension'); |
| 117 } | 114 } |
| 118 | 115 |
| 119 Compiler compiler = new Compiler(readStringFromUri, | 116 Compiler compiler = new Compiler(readStringFromUri, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 167 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 171 | 168 |
| 172 List<Uri> libraries = <Uri>[]; | 169 List<Uri> libraries = <Uri>[]; |
| 173 memorySourceFiles.forEach((String path, _) { | 170 memorySourceFiles.forEach((String path, _) { |
| 174 libraries.add(new Uri(scheme: 'memory', path: path)); | 171 libraries.add(new Uri(scheme: 'memory', path: path)); |
| 175 }); | 172 }); |
| 176 | 173 |
| 177 return analyze(libraries, libraryRoot, packageRoot, | 174 return analyze(libraries, libraryRoot, packageRoot, |
| 178 provider, handler, options); | 175 provider, handler, options); |
| 179 } | 176 } |
| OLD | NEW |