| 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_source_file_helper; | 5 library dart2js.test.memory_source_file_helper; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 export 'dart:io' show Platform; | 8 export 'dart:io' show Platform; |
| 9 | 9 |
| 10 export 'package:compiler/src/apiimpl.dart' | 10 export 'package:compiler/src/apiimpl.dart' show CompilerImpl; |
| 11 show CompilerImpl; | |
| 12 | 11 |
| 13 export 'package:compiler/src/filenames.dart' | 12 export 'package:compiler/src/filenames.dart' show currentDirectory; |
| 14 show currentDirectory; | |
| 15 | 13 |
| 16 import 'package:compiler/src/io/source_file.dart' | 14 import 'package:compiler/src/io/source_file.dart' |
| 17 show StringSourceFile, SourceFile; | 15 show StringSourceFile, SourceFile; |
| 18 | 16 |
| 19 import 'package:compiler/src/source_file_provider.dart' | 17 import 'package:compiler/src/source_file_provider.dart' show SourceFileProvider; |
| 20 show SourceFileProvider; | |
| 21 | 18 |
| 22 export 'package:compiler/src/source_file_provider.dart' | 19 export 'package:compiler/src/source_file_provider.dart' |
| 23 show SourceFileProvider, FormattingDiagnosticHandler; | 20 show SourceFileProvider, FormattingDiagnosticHandler; |
| 24 | 21 |
| 25 class MemorySourceFileProvider extends SourceFileProvider { | 22 class MemorySourceFileProvider extends SourceFileProvider { |
| 26 Map<String, String> memorySourceFiles; | 23 Map<String, String> memorySourceFiles; |
| 27 | 24 |
| 28 MemorySourceFileProvider(Map<String, String> this.memorySourceFiles); | 25 MemorySourceFileProvider(Map<String, String> this.memorySourceFiles); |
| 29 | 26 |
| 30 Future<String> readStringFromUri(Uri resourceUri) { | 27 Future<String> readStringFromUri(Uri resourceUri) { |
| 31 if (resourceUri.scheme != 'memory') { | 28 if (resourceUri.scheme != 'memory') { |
| 32 return super.readStringFromUri(resourceUri); | 29 return super.readStringFromUri(resourceUri); |
| 33 } | 30 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 51 if (source == null) { | 48 if (source == null) { |
| 52 throw new Exception( | 49 throw new Exception( |
| 53 'No such memory file $resourceUri in ${memorySourceFiles.keys}'); | 50 'No such memory file $resourceUri in ${memorySourceFiles.keys}'); |
| 54 } | 51 } |
| 55 return new StringSourceFile.fromUri(resourceUri, source); | 52 return new StringSourceFile.fromUri(resourceUri, source); |
| 56 } | 53 } |
| 57 | 54 |
| 58 @override | 55 @override |
| 59 Future readFromUri(Uri resourceUri) => readStringFromUri(resourceUri); | 56 Future readFromUri(Uri resourceUri) => readStringFromUri(resourceUri); |
| 60 } | 57 } |
| OLD | NEW |