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

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

Issue 1881013002: Expand ResolvedAst to handle synthetic constructors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments + fix test, cps and compilation units for injected members. Created 4 years, 8 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 | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/elements.dart
diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart
index 86a5f41576558cce89f481763b4a8cd7571db7ff..79151eb29aa5264724b20341b76901ea3c884ddc 100644
--- a/pkg/compiler/lib/src/elements/elements.dart
+++ b/pkg/compiler/lib/src/elements/elements.dart
@@ -1626,14 +1626,71 @@ abstract class AstElement extends AnalyzableElement {
ResolvedAst get resolvedAst;
}
-class ResolvedAst {
+/// Enum values for different ways of defining semantics for an element.
+enum ResolvedAstKind {
+ /// The semantics of the element is defined in terms of an AST with resolved
+ /// data mapped in [TreeElements].
+ PARSED,
+
+ /// The element is an implicit default constructor. No AST or [TreeElements]
+ /// are provided.
+ DEFAULT_CONSTRUCTOR,
+
+ /// The element is an implicit forwarding constructor on a mixin application.
+ /// No AST or [TreeElements] are provided.
+ FORWARDING_CONSTRUCTOR,
+}
+
+/// [ResolvedAst] contains info that define the semantics of an element.
+abstract class ResolvedAst {
+ /// The element whose semantics is defined.
+ Element get element;
+
+ /// The kind of semantics definition used for this object.
+ ResolvedAstKind get kind;
+
+ /// The AST node for [element]. This only available of [kind] is
+ /// `ResolvedAstKind.PARSED`.
+ Node get node;
+
+ /// The [TreeElements] containing the resolution data for [node]. This only
+ /// available of [kind] is `ResolvedAstKind.PARSED`.
+ TreeElements get elements;
+}
+
+/// [ResolvedAst] implementation used for elements whose semantics is defined in
+/// terms an AST and a [TreeElements].
+class ParsedResolvedAst implements ResolvedAst {
final Element element;
final Node node;
final TreeElements elements;
- ResolvedAst(this.element, this.node, this.elements);
+ ParsedResolvedAst(this.element, this.node, this.elements);
+
+ ResolvedAstKind get kind => ResolvedAstKind.PARSED;
+
+ String toString() => '$kind:$element:$node';
+}
+
+/// [ResolvedAst] implementation used for synthesized elements whose semantics
+/// is not defined in terms an AST and a [TreeElements].
+class SynthesizedResolvedAst implements ResolvedAst {
+ final Element element;
+ final ResolvedAstKind kind;
+
+ SynthesizedResolvedAst(this.element, this.kind);
+
+ @override
+ TreeElements get elements {
+ throw new UnsupportedError('$this does not provide a TreeElements');
+ }
+
+ @override
+ Node get node {
+ throw new UnsupportedError('$this does not have an AST');
+ }
- String toString() => '$element:$node';
+ String toString() => '$kind:$element';
}
/// A [MemberSignature] is a member of an interface.
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698