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

Unified Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 1504763003: Make NamedMixinApplicationElementX and EnumClassElementX implement DeclarationSite. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « no previous file | pkg/compiler/lib/src/parser/element_listener.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/modelx.dart
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index 95b2b2abbe54df58354e06de7ce56be387ff25b4..6f289d0249d251b2c381298779d2c08c1a77771b 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -45,6 +45,12 @@ import 'elements.dart';
import 'visitor.dart' show
ElementVisitor;
+/// Object that identifies a declaration site.
+///
+/// For most elements, this is the element itself, but for variable declarations
+/// where multi-declarations like `var a, b, c` are allowed, the declaration
+/// site is a separate object.
+// TODO(johnniwinther): Add [beginToken] and [endToken] getters.
abstract class DeclarationSite {
}
@@ -2790,7 +2796,8 @@ abstract class ClassElementX extends BaseClassElementX {
}
}
-class EnumClassElementX extends ClassElementX implements EnumClassElement {
+class EnumClassElementX extends ClassElementX
+ implements EnumClassElement, DeclarationSite {
final Enum node;
List<FieldElement> _enumValues;
@@ -2827,6 +2834,9 @@ class EnumClassElementX extends ClassElementX implements EnumClassElement {
message: "enumValues has already been computed for $this."));
_enumValues = values;
}
+
+ @override
+ DeclarationSite get declarationSite => this;
}
class EnumConstructorElementX extends ConstructorElementX {
@@ -2887,17 +2897,14 @@ class EnumFieldElementX extends FieldElementX {
}
}
-class MixinApplicationElementX extends BaseClassElementX
+abstract class MixinApplicationElementX extends BaseClassElementX
implements MixinApplicationElement {
- final Node node;
- final Modifiers modifiers;
Link<ConstructorElement> constructors = new Link<ConstructorElement>();
InterfaceType mixinType;
- MixinApplicationElementX(String name, Element enclosing, int id,
- this.node, this.modifiers)
+ MixinApplicationElementX(String name, Element enclosing, int id)
: super(name, enclosing, id, STATE_NOT_STARTED);
ClassElement get mixin => mixinType != null ? mixinType.element : null;
@@ -2974,6 +2981,35 @@ class MixinApplicationElementX extends BaseClassElementX
}
}
+class NamedMixinApplicationElementX extends MixinApplicationElementX
+ implements DeclarationSite {
+ final NamedMixinApplication node;
+
+ NamedMixinApplicationElementX(
+ String name,
+ CompilationUnitElement enclosing,
+ int id,
+ this.node)
+ : super(name, enclosing, id);
+
+ Modifiers get modifiers => node.modifiers;
+
+ DeclarationSite get declarationSite => this;
+}
+
+class UnnamedMixinApplicationElementX extends MixinApplicationElementX {
+ final Node node;
+
+ UnnamedMixinApplicationElementX(
+ String name,
+ CompilationUnitElement enclosing,
+ int id,
+ this.node)
+ : super(name, enclosing, id);
+
+ bool get isAbstract => true;
+}
+
class LabelDefinitionX implements LabelDefinition {
final Label label;
final String labelName;
« no previous file with comments | « no previous file | pkg/compiler/lib/src/parser/element_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698