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

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

Issue 821593004: Create erroneous element when resolution of initializer fails. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Tests passing locally. Created 5 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
« no previous file with comments | « no previous file | dart/pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/compiler/lib/src/elements/modelx.dart
diff --git a/dart/pkg/compiler/lib/src/elements/modelx.dart b/dart/pkg/compiler/lib/src/elements/modelx.dart
index bad86bc712ce83f16670bcaa8dc729c25dc51c9c..e1b4f516821e8a965f4eca959cb8ef3797eebb25 100644
--- a/dart/pkg/compiler/lib/src/elements/modelx.dart
+++ b/dart/pkg/compiler/lib/src/elements/modelx.dart
@@ -1272,6 +1272,79 @@ class FieldElementX extends VariableElementX
}
}
+/// A field that was synthesized to recover from a compile-time error.
+class ErroneousFieldElementX extends ElementX implements FieldElementX {
+ final VariableList variables;
+
+ ErroneousFieldElementX(Identifier name, Element enclosingElement)
+ : variables = new VariableList(Modifiers.EMPTY)
+ ..definitions = new VariableDefinitions(
+ null, Modifiers.EMPTY, new NodeList.singleton(name))
+ ..type = const DynamicType(),
+ super(name.source, ElementKind.FIELD, enclosingElement);
+
+ VariableDefinitions get definitionsCache => variables.definitions;
+
+ set definitionsCache(VariableDefinitions _) {
+ throw new UnsupportedError("definitionsCache=");
+ }
+
+ bool get hasNode => true;
+
+ VariableDefinitions get node => definitionsCache;
+
+ bool get hasResolvedAst => false;
+
+ ResolvedAst get resolvedAst {
+ throw new UnsupportedError("resolvedAst");
+ }
+
+ DynamicType get type => const DynamicType();
+
+ Token get token => node.getBeginToken();
+
+ get initializerCache {
+ throw new UnsupportedError("initializerCache");
+ }
+
+ set initializerCache(_) {
+ throw new UnsupportedError("initializerCache=");
+ }
+
+ void createDefinitions(VariableDefinitions definitions) {
+ throw new UnsupportedError("createDefinitions");
+ }
+
+ get initializer => null;
+
+ bool get isErroneous => true;
+
+ get nestedClosures {
+ throw new UnsupportedError("nestedClosures");
+ }
+
+ set nestedClosures(_) {
+ throw new UnsupportedError("nestedClosures=");
+ }
+
+ // TODO(ahe): Should this throw or do nothing?
+ accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
+
+ // TODO(ahe): Should return the context of the error site?
+ MemberElement get memberContext => this;
+
+ // TODO(ahe): Should return the definingElement of the error site?
+ AstElement get definingElement => this;
+
+ void reuseElement() {
+ throw new UnsupportedError("reuseElement");
+ }
+
+ FieldElementX copyWithEnclosing(Element enclosingElement) {
+ throw new UnsupportedError("copyWithEnclosing");
+ }
+}
+
/// [Element] for a parameter-like element.
class FormalElementX extends ElementX
with AstElementMixin
« no previous file with comments | « no previous file | dart/pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698