Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: tests/compiler/dart2js/memory_source_file_helper.dart

Issue 2150333002: Serialize this-types in NativeBehavior separately. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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'
(...skipping 15 matching lines...) Expand all
26 Map<String, String> memorySourceFiles; 26 Map<String, String> memorySourceFiles;
27 27
28 MemorySourceFileProvider(Map<String, String> this.memorySourceFiles); 28 MemorySourceFileProvider(Map<String, String> this.memorySourceFiles);
29 29
30 Future<String> readStringFromUri(Uri resourceUri) { 30 Future<String> readStringFromUri(Uri resourceUri) {
31 if (resourceUri.scheme != 'memory') { 31 if (resourceUri.scheme != 'memory') {
32 return super.readStringFromUri(resourceUri); 32 return super.readStringFromUri(resourceUri);
33 } 33 }
34 String source = memorySourceFiles[resourceUri.path]; 34 String source = memorySourceFiles[resourceUri.path];
35 if (source == null) { 35 if (source == null) {
36 return new Future.error(new Exception('No such file $resourceUri')); 36 return new Future.error(new Exception(
37 'No such memory file $resourceUri in ${memorySourceFiles.keys}'));
37 } 38 }
38 this.sourceFiles[resourceUri] = 39 this.sourceFiles[resourceUri] =
39 new StringSourceFile.fromUri(resourceUri, source); 40 new StringSourceFile.fromUri(resourceUri, source);
40 return new Future.value(source); 41 return new Future.value(source);
41 } 42 }
42 43
43 Future<String> call(Uri resourceUri) => readStringFromUri(resourceUri); 44 Future<String> call(Uri resourceUri) => readStringFromUri(resourceUri);
44 45
45 SourceFile getSourceFile(Uri resourceUri) { 46 SourceFile getSourceFile(Uri resourceUri) {
46 if (resourceUri.scheme != 'memory') { 47 if (resourceUri.scheme != 'memory') {
47 return super.getSourceFile(resourceUri); 48 return super.getSourceFile(resourceUri);
48 } 49 }
49 String source = memorySourceFiles[resourceUri.path]; 50 String source = memorySourceFiles[resourceUri.path];
50 if (source == null) { 51 if (source == null) {
51 throw new Exception('No such file $resourceUri'); 52 throw new Exception(
53 'No such memory file $resourceUri in ${memorySourceFiles.keys}');
52 } 54 }
53 return new StringSourceFile.fromUri(resourceUri, source); 55 return new StringSourceFile.fromUri(resourceUri, source);
54 } 56 }
55 57
56 @override 58 @override
57 Future readFromUri(Uri resourceUri) => readStringFromUri(resourceUri); 59 Future readFromUri(Uri resourceUri) => readStringFromUri(resourceUri);
58 } 60 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/serialization.dart ('k') | tests/compiler/dart2js/serialization/helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698