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

Unified Diff: sdk/lib/_internal/compiler/implementation/typechecker.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/typechecker.dart
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index 9572643066b468c27a90d0a62e17b7200f0a6716..670e83b714cd74aea779e41d250005f53a8ebebc 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -36,6 +36,7 @@ class TypeKind {
static const TypeKind STATEMENT = const TypeKind('statement');
static const TypeKind TYPEDEF = const TypeKind('typedef');
static const TypeKind TYPE_VARIABLE = const TypeKind('type variable');
+ static const TypeKind MALFORMED_TYPE = const TypeKind('malformed');
static const TypeKind VOID = const TypeKind('void');
String toString() => id;
@@ -150,6 +151,24 @@ class VoidType extends DartType {
String toString() => name.slowToString();
}
+class MalformedType extends DartType {
+ const MalformedType(this.element);
+
+ TypeKind get kind => TypeKind.MALFORMED_TYPE;
+
+ SourceString get name => element.name;
+
+ final MalformedTypeElement element;
+
+ DartType unalias(Compiler compiler) => this;
+
+ int get hashCode => 1733;
+
+ bool operator ==(other) => other is MalformedType;
ngeoffray 2012/11/27 09:37:35 Not checking if elements are equal is kind of stra
aam-me 2012/11/28 01:49:47 Good point. I used VoidType above as a template.
+
+ String toString() => name.slowToString();
+}
+
class InterfaceType extends DartType {
final Element element;
final Link<DartType> arguments;
@@ -321,6 +340,8 @@ class Types {
if (t is VoidType) {
return false;
+ } else if (t is MalformedType) {
+ return false;
} else if (t is InterfaceType) {
if (s is !InterfaceType) return false;
ClassElement tc = t.element;

Powered by Google App Engine
This is Rietveld 408576698