| 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 {
|
|
|