Index: tests/compiler/dart2js/memory_source_file_helper.dart |
diff --git a/tests/compiler/dart2js/memory_source_file_helper.dart b/tests/compiler/dart2js/memory_source_file_helper.dart |
index f8ecb277a63f4881951fcfebef8b8eedb58f4d6d..8ebdf7d6763223ad1d2c4e5f63cbb651b049349b 100644 |
--- a/tests/compiler/dart2js/memory_source_file_helper.dart |
+++ b/tests/compiler/dart2js/memory_source_file_helper.dart |
@@ -24,14 +24,17 @@ export '../../../sdk/lib/_internal/compiler/implementation/source_file_provider. |
show SourceFileProvider, FormattingDiagnosticHandler; |
class MemorySourceFileProvider extends SourceFileProvider { |
- static Map MEMORY_SOURCE_FILES; |
+ final Map<String, String> memorySourceFiles; |
+ |
+ MemorySourceFileProvider(Map<String, String> this.memorySourceFiles); |
+ |
Future<String> readStringFromUri(Uri resourceUri) { |
if (resourceUri.scheme != 'memory') { |
return super.readStringFromUri(resourceUri); |
} |
- String source = MEMORY_SOURCE_FILES[resourceUri.path]; |
+ String source = memorySourceFiles[resourceUri.path]; |
// TODO(ahe): Return new Future.error(...) ? |
- if (source == null) throw 'No such file $resourceUri'; |
+ if (source == null) return new Future.error('No such file $resourceUri'); |
String resourceName = '$resourceUri'; |
this.sourceFiles[resourceName] = new SourceFile(resourceName, source); |
return new Future.value(source); |