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

Unified Diff: dart/frog/leg/elements/elements.dart

Issue 9689045: Library privacy. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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
« no previous file with comments | « no previous file | dart/frog/leg/emitter.dart » ('j') | dart/frog/leg/namer.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/elements/elements.dart
diff --git a/dart/frog/leg/elements/elements.dart b/dart/frog/leg/elements/elements.dart
index 4850bc075138726cbe2bab1ebd806ba234b72312..de049c41238ca4ab3e4dac69b87e674a978ce3c8 100644
--- a/dart/frog/leg/elements/elements.dart
+++ b/dart/frog/leg/elements/elements.dart
@@ -132,7 +132,9 @@ class Element implements Hashable {
return token;
}
- const Element(this.name, this.kind, this.enclosingElement);
+ Element(this.name, this.kind, this.enclosingElement) {
+ assert(getLibrary() !== null);
+ }
// TODO(kasperl): This is a very bad hash code for the element and
// there's no reason why two elements with the same name should have
@@ -282,7 +284,7 @@ class LibraryElement extends CompilationUnitElement {
if (this === e.getLibrary()
&& e.kind !== ElementKind.PREFIX
&& e.kind !== ElementKind.FOREIGN) {
- f(e);
+ if (!e.name.isPrivate()) f(e);
}
});
}
@@ -682,7 +684,11 @@ class ClassElement extends ContainerElement {
Element lookupSuperMember(SourceString name) {
for (ClassElement s = superclass; s != null; s = s.superclass) {
Element e = s.lookupLocalMember(name);
- if (e !== null) return e;
+ if (e !== null) {
+ if (!name.isPrivate() || getLibrary() === e.getLibrary()) {
+ return e;
+ }
+ }
}
return null;
}
« no previous file with comments | « no previous file | dart/frog/leg/emitter.dart » ('j') | dart/frog/leg/namer.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698