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

Unified Diff: compiler/java/com/google/dart/compiler/ast/LibraryUnit.java

Issue 10919133: Support for new 'export' directive in resolver (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweak for parsing import/export directives Created 8 years, 3 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/java/com/google/dart/compiler/ast/LibraryUnit.java
diff --git a/compiler/java/com/google/dart/compiler/ast/LibraryUnit.java b/compiler/java/com/google/dart/compiler/ast/LibraryUnit.java
index 95b849ddf8274740b129656c2c6d63af2c9bf2d0..f5b0d3f24861449781366c328a411938643400c7 100644
--- a/compiler/java/com/google/dart/compiler/ast/LibraryUnit.java
+++ b/compiler/java/com/google/dart/compiler/ast/LibraryUnit.java
@@ -32,11 +32,13 @@ public class LibraryUnit {
private final LibrarySource libSource;
private final LibraryNode selfSourcePath;
private final List<LibraryNode> importPaths = Lists.newArrayList();
+ private final List<LibraryNode> exportPaths = Lists.newArrayList();
private final List<LibraryNode> sourcePaths = Lists.newArrayList();
private final List<LibraryNode> nativePaths = Lists.newArrayList();
private final Map<String, DartUnit> units = new ConcurrentSkipListMap<String, DartUnit>();
private final List<LibraryImport> imports = Lists.newArrayList();
+ private final List<LibraryExport> exports = Lists.newArrayList();
private final LibraryElement element;
@@ -79,6 +81,11 @@ public class LibraryUnit {
assert path != null;
importPaths.add(path);
}
+
+ public void addExportPath(LibraryNode path) {
+ assert path != null;
+ exportPaths.add(path);
+ }
public void addSourcePath(LibraryNode path) {
assert path != null;
@@ -107,10 +114,17 @@ public class LibraryUnit {
public void addImport(LibraryUnit unit, LibraryNode node) {
if (unit != null) {
if (node != null) {
- imports.add(new LibraryImport(unit, node.getPrefix(), node.getCombinators(),
- node.isExported()));
+ imports.add(new LibraryImport(unit, node.getPrefix(), node.getCombinators()));
} else {
- imports.add(new LibraryImport(unit, null, ImmutableList.<ImportCombinator> of(), false));
+ imports.add(new LibraryImport(unit, null, ImmutableList.<ImportCombinator> of()));
+ }
+ }
+ }
+
+ public void addExport(LibraryUnit unit, LibraryNode node) {
+ if (unit != null) {
+ if (node != null) {
+ exports.add(new LibraryExport(unit, node.getCombinators()));
}
}
}
@@ -136,6 +150,10 @@ public class LibraryUnit {
public Iterable<LibraryImport> getImports() {
return imports;
}
+
+ public List<LibraryExport> getExports() {
+ return exports;
+ }
public Iterable<LibraryUnit> getImportedLibraries() {
Set<LibraryUnit> libraries = Sets.newHashSet();
@@ -146,8 +164,7 @@ public class LibraryUnit {
}
public boolean hasImport(LibraryUnit unit) {
- return imports.contains(new LibraryImport(unit, null, ImmutableList.<ImportCombinator> of(),
- false));
+ return imports.contains(new LibraryImport(unit, null, ImmutableList.<ImportCombinator> of()));
}
public DartExpression getEntryPoint() {
@@ -175,6 +192,10 @@ public class LibraryUnit {
public Iterable<LibraryNode> getImportPaths() {
return importPaths;
}
+
+ public Iterable<LibraryNode> getExportPaths() {
+ return exportPaths;
+ }
/**
* Return all prefixes used by this library.

Powered by Google App Engine
This is Rietveld 408576698