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

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

Issue 9117033: Setup getter and setter elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 11 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 | « dart/frog/leg/compiler.dart ('k') | dart/frog/leg/emitter.dart » ('j') | no next file with comments »
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 add1f013f00ad55dbbf4091f9b326a1619a641d3..d7ad2ef7ef0ddb63d26c55904c916cfa6f10554a 100644
--- a/dart/frog/leg/elements/elements.dart
+++ b/dart/frog/leg/elements/elements.dart
@@ -38,6 +38,8 @@ class ElementKind {
const ElementKind('generative_constructor_body');
static final ElementKind COMPILATION_UNIT =
const ElementKind('compilation_unit');
+ static final ElementKind GETTER = const ElementKind('getter');
+ static final ElementKind SETTER = const ElementKind('setter');
toString() => id;
}
@@ -73,6 +75,8 @@ class Element implements Hashable {
return true;
}
+ Token position() => null;
+
const Element(this.name, this.kind, this.enclosingElement);
// TODO(kasperl): This is a very bad hash code for the element and
@@ -132,6 +136,13 @@ class VariableElement extends Element {
bool isInstanceMember() {
return isMember() && !modifiers.isStatic();
}
+
+ Token position() {
+ // TODO(ahe): Record the token corresponding to name instead of
+ // returning different values at different points in time.
+ return (cachedNode !== null)
+ ? cachedNode.getBeginToken() : variables.position();
+ }
}
// This element represents a list of variable or field declaration.
@@ -165,6 +176,8 @@ class VariableListElement extends Element {
compiler.types);
return type;
}
+
+ Token position() => cachedNode.getBeginToken();
}
class ForeignElement extends Element {
@@ -261,6 +274,8 @@ class FunctionElement extends Element {
}
Node parseNode(Canceler canceler, Logger logger) => cachedNode;
+
+ Token position() => cachedNode.getBeginToken();
}
class ConstructorBodyElement extends FunctionElement {
@@ -285,6 +300,8 @@ class ConstructorBodyElement extends FunctionElement {
assert(cachedNode !== null);
return cachedNode;
}
+
+ Token position() => constructor.position();
}
class SynthesizedConstructorElement extends FunctionElement {
@@ -310,6 +327,8 @@ class SynthesizedConstructorElement extends FunctionElement {
null, null, null);
return cachedNode;
}
+
+ Token position() => null;
}
class ClassElement extends Element {
« no previous file with comments | « dart/frog/leg/compiler.dart ('k') | dart/frog/leg/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698