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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2996723002: Support typedef type literals (Closed)
Patch Set: Cleanup Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../closure.dart'; 7 import '../closure.dart';
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/codegen.dart' show CodegenRegistry; 9 import '../common/codegen.dart' show CodegenRegistry;
10 import '../common/names.dart'; 10 import '../common/names.dart';
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 void visitMapEntry(ir.MapEntry mapEntry) { 2117 void visitMapEntry(ir.MapEntry mapEntry) {
2118 // Visit value before the key because each will push an expression to the 2118 // Visit value before the key because each will push an expression to the
2119 // stack, so when we pop them off, the key is popped first, then the value. 2119 // stack, so when we pop them off, the key is popped first, then the value.
2120 mapEntry.value.accept(this); 2120 mapEntry.value.accept(this);
2121 mapEntry.key.accept(this); 2121 mapEntry.key.accept(this);
2122 } 2122 }
2123 2123
2124 @override 2124 @override
2125 void visitTypeLiteral(ir.TypeLiteral typeLiteral) { 2125 void visitTypeLiteral(ir.TypeLiteral typeLiteral) {
2126 ir.DartType type = typeLiteral.type; 2126 ir.DartType type = typeLiteral.type;
2127 if (type is ir.InterfaceType || type is ir.DynamicType) { 2127 if (type is ir.InterfaceType ||
2128 type is ir.DynamicType ||
2129 type is ir.TypedefType ||
2130 type is ir.FunctionType) {
2128 ConstantValue constant = _elementMap.getConstantValue(typeLiteral); 2131 ConstantValue constant = _elementMap.getConstantValue(typeLiteral);
2129 stack.add(graph.addConstant(constant, closedWorld)); 2132 stack.add(graph.addConstant(constant, closedWorld));
2130 return; 2133 return;
2131 } 2134 }
2135 assert(
2136 type is ir.TypeParameterType,
2137 failedAt(CURRENT_ELEMENT_SPANNABLE,
2138 "Unexpected type literal ${typeLiteral}."));
2132 // For other types (e.g. TypeParameterType, function types from expanded 2139 // For other types (e.g. TypeParameterType, function types from expanded
2133 // typedefs), look-up or construct a reified type representation and convert 2140 // typedefs), look-up or construct a reified type representation and convert
2134 // to a RuntimeType. 2141 // to a RuntimeType.
2135 2142
2136 DartType dartType = _elementMap.getDartType(type); 2143 DartType dartType = _elementMap.getDartType(type);
2137 dartType = localsHandler.substInContext(dartType); 2144 dartType = localsHandler.substInContext(dartType);
2138 HInstruction value = typeBuilder 2145 HInstruction value = typeBuilder
2139 .analyzeTypeArgument(dartType, sourceElement, sourceInformation: null); 2146 .analyzeTypeArgument(dartType, sourceElement, sourceInformation: null);
2140 _pushStaticInvocation(_commonElements.runtimeTypeToString, 2147 _pushStaticInvocation(_commonElements.runtimeTypeToString,
2141 <HInstruction>[value], commonMasks.stringType); 2148 <HInstruction>[value], commonMasks.stringType);
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3656 enterBlock.setBlockFlow( 3663 enterBlock.setBlockFlow(
3657 new HTryBlockInformation( 3664 new HTryBlockInformation(
3658 kernelBuilder.wrapStatementGraph(bodyGraph), 3665 kernelBuilder.wrapStatementGraph(bodyGraph),
3659 exception, 3666 exception,
3660 kernelBuilder.wrapStatementGraph(catchGraph), 3667 kernelBuilder.wrapStatementGraph(catchGraph),
3661 kernelBuilder.wrapStatementGraph(finallyGraph)), 3668 kernelBuilder.wrapStatementGraph(finallyGraph)),
3662 exitBlock); 3669 exitBlock);
3663 kernelBuilder.inTryStatement = previouslyInTryStatement; 3670 kernelBuilder.inTryStatement = previouslyInTryStatement;
3664 } 3671 }
3665 } 3672 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698