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

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

Issue 10996039: Bring type variables into static scope, but produce compile-time error when they are used. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Produce warning and dynamic type error instead of compile-time error. Created 8 years, 2 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
Index: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 71a7d0007dc859acdfd21e5800441658cf7d6755..aa3b9c43d110a76b2c72f58f3fa5bb1855721886 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -103,6 +103,8 @@ class ElementKind {
const ElementKind('label', ElementCategory.NONE);
static const ElementKind VOID =
const ElementKind('void', ElementCategory.NONE);
+ static const ElementKind MALFORMED_TYPE =
+ const ElementKind('malformed', ElementCategory.NONE);
toString() => id;
}
@@ -332,6 +334,10 @@ class Element implements Spannable {
FunctionElement asFunctionElement() => null;
static bool isInvalid(Element e) => e == null || e.isErroneous();
+
+ bool inStaticContext() {
+ return modifiers.isStatic();
+ }
}
/**
@@ -1221,6 +1227,17 @@ class VoidElement extends Element {
bool impliesType() => true;
}
+class MalformedTypeElement extends Element {
+ final TypeAnnotation type;
+ MalformedTypeElement(this.type, Element enclosing)
+ : super(const SourceString('malformed'),
+ ElementKind.MALFORMED_TYPE,
+ enclosing);
+ DartType computeType(compiler) => compiler.types.malformedType;
+ Node parseNode(DiagnosticListener dl) => type;
+ bool impliesType() => true;
+}
+
/**
* [TypeDeclarationElement] defines the common interface for class/interface
* declarations and typedefs.
« no previous file with comments | « no previous file | lib/compiler/implementation/js_backend/namer.dart » ('j') | lib/compiler/implementation/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698