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

Unified Diff: sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart

Issue 355373002: dart2dart: Fixed treatment of dynamic type literals in new IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Pass DartType to LiteralType Created 6 years, 6 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 | « sdk/lib/_internal/compiler/implementation/ir/const_expression.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart b/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart
index 5999c98bdba3525aa0db233f865872ee32f4f99a..eca0b6718a54ed2f66a4049daf9ff70ea2a3ee8a 100644
--- a/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart
@@ -1235,21 +1235,19 @@ class IrBuilder extends ResolvedVisitor<ir.Primitive> {
ir.Primitive visitTypeReferenceSend(ast.Send node) {
assert(isOpen);
- Element element = elements[node];
- assert(element is TypeDeclarationElement || element.isTypeVariable);
-
// If the user is trying to invoke the type literal or variable,
// it must be treated as a function call.
if (node.argumentsNode != null) {
return visitDynamicSend(node);
}
- if (element is TypeDeclarationElement) {
- return translateConstant(node);
- } else {
- ir.Primitive prim = new ir.ReifyTypeVar(element);
+ DartType type = elements.getTypeLiteralType(node);
+ if (type is TypeVariableType) {
+ ir.Primitive prim = new ir.ReifyTypeVar(type.element);
add(new ir.LetPrim(prim));
return prim;
+ } else {
+ return translateConstant(node);
}
}
@@ -1528,8 +1526,9 @@ class ConstExpBuilder extends ast.Visitor<ConstExp> {
else
return new VariableConstExp(element);
}
- if (Elements.isClass(element) || Elements.isTypedef(element)) {
- return new TypeConstExp(element);
+ DartType type = elements.getTypeLiteralType(node);
+ if (type != null) {
+ return new TypeConstExp(type);
}
throw "Unexpected constant Send: $node";
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ir/const_expression.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698