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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 359413006: Fix handling of type literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. 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
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 81777495e9744e52ea2901c00533bf3616743208..bd94d10ac3f4ff90869659a8e66dd11d3db7acc2 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -4316,9 +4316,13 @@ class SsaBuilder extends ResolvedVisitor {
return graph.addConstant(constant, compiler);
}
- visitTypeReferenceSend(ast.Send node) {
- Element element = elements[node];
- if (element.isClass || element.isTypedef) {
+ visitTypePrefixSend(ast.Send node) {
+ compiler.internalError(node, "visitTypePrefixSend should not be called.");
+ }
+
+ visitTypeLiteralSend(ast.Send node) {
+ DartType type = elements.getTypeLiteralType(node);
+ if (type.isInterfaceType || type.isTypedef || type.isDynamic) {
// TODO(karlklose): add type representation
if (node.isCall) {
// The node itself is not a constant but we register the selector (the
@@ -4327,9 +4331,8 @@ class SsaBuilder extends ResolvedVisitor {
} else {
stack.add(addConstant(node));
}
- } else if (element.isTypeVariable) {
- TypeVariableElement typeVariable = element;
- DartType type = localsHandler.substInContext(typeVariable.type);
+ } else if (type.isTypeVariable) {
+ type = localsHandler.substInContext(type);
HInstruction value = analyzeTypeArgument(type);
pushInvokeStatic(node,
backend.getRuntimeTypeToString(),
@@ -4339,7 +4342,7 @@ class SsaBuilder extends ResolvedVisitor {
backend.getCreateRuntimeType(),
[pop()]);
} else {
- internalError('unexpected element kind $element', node: node);
+ internalError('unexpected type kind ${type.kind}', node: node);
}
if (node.isCall) {
// This send is of the form 'e(...)', where e is resolved to a type
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolved_visitor.dart ('k') | tests/language/dynamic_type_literal_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698