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

Unified Diff: sdk/lib/_internal/compiler/implementation/closure.dart

Issue 96623004: Add a visitor for Elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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: sdk/lib/_internal/compiler/implementation/closure.dart
diff --git a/sdk/lib/_internal/compiler/implementation/closure.dart b/sdk/lib/_internal/compiler/implementation/closure.dart
index 38c18ee087e8ccd6c8891e4d631c6b72fba4aff8..11529b6cf7756d91fba9e23add635955bd5051bd 100644
--- a/sdk/lib/_internal/compiler/implementation/closure.dart
+++ b/sdk/lib/_internal/compiler/implementation/closure.dart
@@ -11,6 +11,7 @@ import "scanner/scannerlib.dart" show Token;
import "tree/tree.dart";
import "util/util.dart";
import "elements/modelx.dart" show ElementX, FunctionElementX, ClassElementX;
+import "elements/visitor.dart" show ElementVisitor;
class ClosureNamer {
String getClosureVariableName(String name, int id) {
@@ -98,6 +99,8 @@ class ClosureFieldElement extends ElementX implements VariableElement {
}
String toString() => "ClosureFieldElement($name)";
+
+ accept(ElementVisitor visitor) => visitor.visitClosureFieldElement(this);
}
// TODO(ahe): These classes continuously cause problems. We need to
@@ -142,6 +145,8 @@ class ClosureClassElement extends ClassElementX {
* The most outer method this closure is declared into.
*/
final Element methodElement;
+
+ accept(ElementVisitor visitor) => visitor.visitClosureClassElement(this);
}
// TODO(ahe): These classes continuously cause problems. We need to
@@ -152,6 +157,8 @@ class BoxElement extends ElementX {
: super(name, ElementKind.VARIABLE_LIST, enclosingElement);
DartType computeType(Compiler compiler) => compiler.types.dynamicType;
+
+ accept(ElementVisitor visitor) => visitor.visitBoxElement(this);
}
// TODO(ngeoffray, ahe): These classes continuously cause problems. We need to
@@ -168,6 +175,8 @@ class BoxFieldElement extends ElementX {
}
final Element variableElement;
+
+ accept(ElementVisitor visitor) => visitor.visitBoxFieldElement(this);
}
// TODO(ahe): These classes continuously cause problems. We need to
@@ -184,6 +193,8 @@ class ThisElement extends ElementX {
// Since there is no declaration corresponding to 'this', use the position of
// the enclosing method.
Token position() => enclosingElement.position();
+
+ accept(ElementVisitor visitor) => visitor.visitThisElement(this);
}
// TODO(ahe): These classes continuously cause problems. We need to
@@ -199,6 +210,8 @@ class CheckVariableElement extends ElementX {
// Since there is no declaration for the synthetic 'check' variable, use
// parameter.
Token position() => parameter.position();
+
+ accept(ElementVisitor visitor) => visitor.visitCheckVariableElement(this);
}
// The box-element for a scope, and the captured variables that need to be

Powered by Google App Engine
This is Rietveld 408576698