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

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 10837095: Refactor scope handling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 1d951796313ebf2a8e5288d1ba8c9784d315d79c..483ccdeffa4455aa24c6c13c619135b72f9e3079 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -214,6 +214,17 @@ class Element implements Hashable {
return null;
}
+ /**
+ * Creates the scope for this element. The scope of the
+ * enclosing element will be the parent scope.
+ */
+ Scope buildScope() => buildEnclosingScope();
+
+ /**
+ * Creates the scope for the enclosing element.
+ */
+ Scope buildEnclosingScope() => enclosingElement.buildScope();
+
String toString() {
// TODO(johnniwinther): Test for nullness of name, or make non-nullness an
// invariant for all element types?
@@ -394,6 +405,8 @@ class LibraryElement extends CompilationUnitElement {
return path.substring(path.lastIndexOf('/') + 1);
}
}
+
+ Scope buildEnclosingScope() => new TopScope(this);
}
class PrefixElement extends Element {
@@ -505,8 +518,8 @@ class VariableListElement extends Element {
/**
* Function signature for a variable with a function type. The signature is
- * kept to provide full information about parameter names through the the
- * mirror system.
+ * kept to provide full information about parameter names through the mirror
+ * system.
*/
FunctionSignature functionSignature;
@@ -613,6 +626,8 @@ class AbstractFieldElement extends Element {
}
}
+// TODO(johnniwinther): [FunctionSignature] should be merged with
+// [FunctionType].
class FunctionSignature {
Link<Element> requiredParameters;
Link<Element> optionalParameters;
@@ -1001,6 +1016,9 @@ class ClassElement extends ContainerElement {
bool isNative() => nativeName != null;
SourceString nativeName;
int hashCode() => id;
+
+ Scope buildScope() =>
+ new ClassScope(enclosingElement.buildScope(), this);
}
class Elements {
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698