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

Unified Diff: compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java

Issue 10139017: Support for same prefix for multiple imports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Detect top-level duplicates in libraries with same prefix Created 8 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: compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java b/compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java
index 6fc88b9d7660748920dd026e3ebb1edd8284b371..b6c2cd3a25bd91dba81c3ad55bbb4069eaaac19f 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java
@@ -8,6 +8,7 @@ import com.google.dart.compiler.DartSource;
import com.google.dart.compiler.LibrarySource;
import com.google.dart.compiler.Source;
import com.google.dart.compiler.UrlDartSource;
+import com.google.dart.compiler.UrlLibrarySource;
import java.io.IOException;
import java.io.Reader;
@@ -60,9 +61,31 @@ public class MemoryLibrarySource implements LibrarySource {
}
@Override
- public LibrarySource getImportFor(String relPath) throws IOException {
- // Not implemented for now, tests which use it don't work with imports.
- return null;
+ public LibrarySource getImportFor(final String relPath) throws IOException {
+ final String content = sourceContentMap.get(relPath);
+ final Long sourceLastModified = sourceLastModifiedMap.get(relPath);
+ URI uri = URI.create(relPath);
+ return new UrlLibrarySource(uri) {
+ @Override
+ public boolean exists() {
+ return content != null;
+ }
+
+ @Override
+ public long getLastModified() {
+ return sourceLastModified.longValue();
+ }
+
+ @Override
+ public Reader getSourceReader() throws IOException {
+ return new StringReader(content);
+ }
+
+ @Override
+ public DartSource getSourceFor(String relPath) {
+ return MemoryLibrarySource.this.getSourceFor(relPath);
+ }
+ };
}
@Override

Powered by Google App Engine
This is Rietveld 408576698