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

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: Use recursion 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
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..72fd376866d0b19decfb39bc815b5f247b635a3b 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,11 @@ class VariableElement extends Element {
bool isInstanceMember() {
return isMember() && !modifiers.isStatic();
}
+
+ Token position() {
+ return (cachedNode !== null)
+ ? cachedNode.getBeginToken() : variables.position();
ngeoffray 2012/01/25 08:36:05 This will return different values in time. Is that
ahe 2012/01/25 08:56:24 You're right. I'll add a todo to record the Token
+ }
}
// This element represents a list of variable or field declaration.
@@ -165,6 +174,8 @@ class VariableListElement extends Element {
compiler.types);
return type;
}
+
+ Token position() => cachedNode.getBeginToken();
}
class ForeignElement extends Element {
@@ -261,6 +272,8 @@ class FunctionElement extends Element {
}
Node parseNode(Canceler canceler, Logger logger) => cachedNode;
+
+ Token position() => cachedNode.getBeginToken();
}
class ConstructorBodyElement extends FunctionElement {
@@ -285,6 +298,8 @@ class ConstructorBodyElement extends FunctionElement {
assert(cachedNode !== null);
return cachedNode;
}
+
+ Token position() => constructor.position();
}
class SynthesizedConstructorElement extends FunctionElement {
@@ -310,6 +325,8 @@ class SynthesizedConstructorElement extends FunctionElement {
null, null, null);
return cachedNode;
}
+
+ Token position() => null;
}
class ClassElement extends Element {

Powered by Google App Engine
This is Rietveld 408576698