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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/elements.dart

Issue 11416144: Produce run-time error when type parameters are accessed from static context. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed redundant malformed type replacement with dynamic type. Created 8 years, 1 month 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
Index: sdk/lib/_internal/compiler/implementation/elements/elements.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/elements.dart b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
index 9df0ec1231e9d7213cd9b2dc110123f2289bcd6d..25899784bf5848ca19c4c797a6b6eaf497757ae9 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/elements.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
@@ -120,6 +120,8 @@ class ElementKind {
const ElementKind('ambiguous', ElementCategory.NONE);
static const ElementKind ERROR =
const ElementKind('error', ElementCategory.NONE);
+ static const ElementKind MALFORMED_TYPE =
+ const ElementKind('malformed', ElementCategory.NONE);
toString() => id;
}
@@ -200,6 +202,8 @@ class Element implements Spannable {
/** See [AmbiguousElement] for documentation. */
bool isAmbiguous() => false;
+ bool isMalformed() => false;
+
/**
* Is [:true:] if this element has a corresponding patch.
*
@@ -1319,6 +1323,23 @@ class VoidElement extends Element {
bool impliesType() => true;
}
+class MalformedTypeElement extends Element {
+ final TypeAnnotation typeNode;
+
+ MalformedTypeElement(this.typeNode, Element enclosing)
+ : super(const SourceString('malformed'),
+ ElementKind.MALFORMED_TYPE,
+ enclosing);
+
+ DartType computeType(compiler) => compiler.types.malformedType;
+
+ Node parseNode(_) => typeNode;
+
+ bool impliesType() => true;
+
+ bool isMalformed() => true;
+}
+
/**
* [TypeDeclarationElement] defines the common interface for class/interface
* declarations and typedefs.
@@ -1724,8 +1745,11 @@ abstract class ClassElement extends ScopeContainerElement
}
class Elements {
- static bool isUnresolved(Element e) => e == null || e.isErroneous();
+ static bool isUnresolved(Element e) {
+ return e == null || e.isErroneous() || e.isMalformed();
+ }
static bool isErroneousElement(Element e) => e != null && e.isErroneous();
+ static bool isMalformedElement(Element e) => e != null && e.isMalformed();
static bool isClass(Element e) => e != null && e.kind == ElementKind.CLASS;
static bool isTypedef(Element e) {

Powered by Google App Engine
This is Rietveld 408576698