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

Unified Diff: dart/tests/compiler/dart2js/memory_source_file_helper.dart

Issue 13866010: Correctly compile unresolved for-in loops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Additional problems found during testing. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: dart/tests/compiler/dart2js/memory_source_file_helper.dart
diff --git a/dart/tests/compiler/dart2js/memory_source_file_helper.dart b/dart/tests/compiler/dart2js/memory_source_file_helper.dart
new file mode 100644
index 0000000000000000000000000000000000000000..16cccf3d7b5c9838ae2c2ad7f34090222363560c
--- /dev/null
+++ b/dart/tests/compiler/dart2js/memory_source_file_helper.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library dart2js.test.memory_source_file_helper;
+
+import 'dart:async' show Future;
+import 'dart:uri' show Uri;
+export 'dart:uri' show Uri;
+import 'dart:io';
+export 'dart:io' show Options;
+
+export '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'
+ show Compiler;
+
+export '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'
+ show getCurrentDirectory, nativeToUriPath;
+
+import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'
+ show SourceFile;
+
+import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.dart'
+ show SourceFileProvider;
+
+export '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.dart'
+ show FormattingDiagnosticHandler;
+
+class MemorySourceFileProvider extends SourceFileProvider {
+ static Map MEMORY_SOURCE_FILES;
+ Future<String> readStringFromUri(Uri resourceUri) {
+ if (resourceUri.scheme != 'memory') {
+ return super.readStringFromUri(resourceUri);
+ }
+ String source = MEMORY_SOURCE_FILES[resourceUri.path];
+ // TODO(ahe): Return new Future.immediateError(...) ?
+ if (source == null) throw 'No such file $resourceUri';
+ String resourceName = '$resourceUri';
+ this.sourceFiles[resourceName] = new SourceFile(resourceName, source);
+ return new Future.immediate(source);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698