| 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 'package:compiler/src/compile_time_constants.dart'; | 9 import 'package:compiler/src/compile_time_constants.dart'; |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 MemorySourceFileProvider provider; | 104 MemorySourceFileProvider provider; |
| 105 var readStringFromUri; | 105 var readStringFromUri; |
| 106 if (cachedCompiler == null) { | 106 if (cachedCompiler == null) { |
| 107 provider = new MemorySourceFileProvider(memorySourceFiles); | 107 provider = new MemorySourceFileProvider(memorySourceFiles); |
| 108 readStringFromUri = provider.readStringFromUri; | 108 readStringFromUri = provider.readStringFromUri; |
| 109 // Saving the provider in case we need it later for a cached compiler. | 109 // Saving the provider in case we need it later for a cached compiler. |
| 110 expando[readStringFromUri] = provider; | 110 expando[readStringFromUri] = provider; |
| 111 } else { | 111 } else { |
| 112 // When using a cached compiler, it has read a number of files from disk | 112 // When using a cached compiler, it has read a number of files from disk |
| 113 // already (and will not attemp to read them again due to caching). These | 113 // already (and will not attempt to read them again due to caching). These |
| 114 // files must be available to the new diagnostic handler. | 114 // files must be available to the new diagnostic handler. |
| 115 provider = expando[cachedCompiler.provider]; | 115 provider = expando[cachedCompiler.provider]; |
| 116 readStringFromUri = cachedCompiler.provider; | 116 readStringFromUri = cachedCompiler.provider; |
| 117 provider.memorySourceFiles = memorySourceFiles; | 117 provider.memorySourceFiles = memorySourceFiles; |
| 118 } | 118 } |
| 119 var handler = | 119 var handler = |
| 120 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 120 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 121 | 121 |
| 122 EventSink<String> noOutputProvider(String name, String extension) { | 122 EventSink<String> noOutputProvider(String name, String extension) { |
| 123 if (name != '') throw 'Attempt to output file "$name.$extension"'; | 123 if (name != '') throw 'Attempt to output file "$name.$extension"'; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 237 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
| 238 | 238 |
| 239 List<Uri> libraries = <Uri>[]; | 239 List<Uri> libraries = <Uri>[]; |
| 240 memorySourceFiles.forEach((String path, _) { | 240 memorySourceFiles.forEach((String path, _) { |
| 241 libraries.add(new Uri(scheme: 'memory', path: path)); | 241 libraries.add(new Uri(scheme: 'memory', path: path)); |
| 242 }); | 242 }); |
| 243 | 243 |
| 244 return analyze(libraries, libraryRoot, packageRoot, | 244 return analyze(libraries, libraryRoot, packageRoot, |
| 245 provider, handler, options); | 245 provider, handler, options); |
| 246 } | 246 } |
| OLD | NEW |