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

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

Issue 10942028: Support class and typedef literals as expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Peter's comments. 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: lib/compiler/implementation/resolved_visitor.dart
diff --git a/lib/compiler/implementation/resolved_visitor.dart b/lib/compiler/implementation/resolved_visitor.dart
index 8120ac4c2def1128432040600c7d72f27ad7e9c4..b115aa99a981b6ddba0944fe75f0009c07518fdf 100644
--- a/lib/compiler/implementation/resolved_visitor.dart
+++ b/lib/compiler/implementation/resolved_visitor.dart
@@ -15,7 +15,13 @@ abstract class ResolvedVisitor<R> extends Visitor<R> {
} else if (node.isOperator) {
return visitOperatorSend(node);
} else if (node.isPropertyAccess) {
- return visitGetterSend(node);
+ Element element = elements[node];
+ if (!Elements.isUnresolved(element) && element.impliesType()) {
+ // A reference to a class literal, typedef or type variable.
+ return visitTypeReferenceSend(node);
+ } else {
+ return visitGetterSend(node);
+ }
} else if (Elements.isClosureSend(node, elements[node])) {
return visitClosureSend(node);
} else {
@@ -28,8 +34,9 @@ abstract class ResolvedVisitor<R> extends Visitor<R> {
} else {
return visitStaticSend(node);
}
- } else if (element.kind == ElementKind.CLASS) {
- internalError("Cannot generate code for send", node: node);
+ } else if (element.impliesType()) {
+ // A reference to a class literal, typedef or type variable.
+ return visitTypeReferenceSend(node);
} else if (element.isInstanceMember()) {
// Example: f() with 'f' bound to instance method.
return visitDynamicSend(node);
@@ -53,6 +60,7 @@ abstract class ResolvedVisitor<R> extends Visitor<R> {
abstract R visitDynamicSend(Send node);
abstract R visitForeignSend(Send node);
abstract R visitStaticSend(Send node);
+ abstract R visitTypeReferenceSend(Send node);
abstract void internalError(String reason, {Node node});

Powered by Google App Engine
This is Rietveld 408576698