Chromium Code Reviews| 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 { |