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

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

Issue 2650493002: dart2js-kernel: handle [TypeLiteral]s that are function types (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, CodegenWorkItem; 9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
10 import '../common/names.dart'; 10 import '../common/names.dart';
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 } 1767 }
1768 1768
1769 @override 1769 @override
1770 void visitTypeLiteral(ir.TypeLiteral typeLiteral) { 1770 void visitTypeLiteral(ir.TypeLiteral typeLiteral) {
1771 ir.DartType type = typeLiteral.type; 1771 ir.DartType type = typeLiteral.type;
1772 if (type is ir.InterfaceType || type is ir.DynamicType) { 1772 if (type is ir.InterfaceType || type is ir.DynamicType) {
1773 ConstantValue constant = astAdapter.getConstantForType(type); 1773 ConstantValue constant = astAdapter.getConstantForType(type);
1774 stack.add(graph.addConstant(constant, closedWorld)); 1774 stack.add(graph.addConstant(constant, closedWorld));
1775 return; 1775 return;
1776 } 1776 }
1777 if (type is ir.TypeParameterType) { 1777 // For other types (e.g. TypeParameterType, function types from expanded
1778 // TODO(sra): Convert the type logic here to use ir.DartType. 1778 // typedefs), look-up or construct a reified type representation and convert
1779 ResolutionDartType dartType = astAdapter.getDartType(type); 1779 // to a RuntimeType.
1780 dartType = localsHandler.substInContext(dartType); 1780
1781 HInstruction value = typeBuilder.analyzeTypeArgument( 1781 // TODO(sra): Convert the type logic here to use ir.DartType.
1782 dartType, sourceElement, 1782 ResolutionDartType dartType = astAdapter.getDartType(type);
1783 sourceInformation: null); 1783 dartType = localsHandler.substInContext(dartType);
1784 _pushStaticInvocation(astAdapter.runtimeTypeToString, 1784 HInstruction value = typeBuilder.analyzeTypeArgument(
1785 <HInstruction>[value], commonMasks.stringType); 1785 dartType, sourceElement,
1786 _pushStaticInvocation(astAdapter.createRuntimeType, <HInstruction>[pop()], 1786 sourceInformation: null);
1787 astAdapter.createRuntimeTypeReturnType); 1787 _pushStaticInvocation(astAdapter.runtimeTypeToString,
1788 return; 1788 <HInstruction>[value], commonMasks.stringType);
1789 } 1789 _pushStaticInvocation(astAdapter.createRuntimeType, <HInstruction>[pop()],
1790 // TODO(27394): Function types observed. Where are they from? 1790 astAdapter.createRuntimeTypeReturnType);
1791 defaultExpression(typeLiteral);
1792 return;
1793 } 1791 }
1794 1792
1795 @override 1793 @override
1796 void visitStaticGet(ir.StaticGet staticGet) { 1794 void visitStaticGet(ir.StaticGet staticGet) {
1797 ir.Member staticTarget = staticGet.target; 1795 ir.Member staticTarget = staticGet.target;
1798 if (staticTarget is ir.Procedure && 1796 if (staticTarget is ir.Procedure &&
1799 staticTarget.kind == ir.ProcedureKind.Getter) { 1797 staticTarget.kind == ir.ProcedureKind.Getter) {
1800 // Invoke the getter 1798 // Invoke the getter
1801 _pushStaticInvocation(staticTarget, const <HInstruction>[], 1799 _pushStaticInvocation(staticTarget, const <HInstruction>[],
1802 astAdapter.returnTypeOf(staticTarget)); 1800 astAdapter.returnTypeOf(staticTarget));
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 enterBlock.setBlockFlow( 3065 enterBlock.setBlockFlow(
3068 new HTryBlockInformation( 3066 new HTryBlockInformation(
3069 kernelBuilder.wrapStatementGraph(bodyGraph), 3067 kernelBuilder.wrapStatementGraph(bodyGraph),
3070 exception, 3068 exception,
3071 kernelBuilder.wrapStatementGraph(catchGraph), 3069 kernelBuilder.wrapStatementGraph(catchGraph),
3072 kernelBuilder.wrapStatementGraph(finallyGraph)), 3070 kernelBuilder.wrapStatementGraph(finallyGraph)),
3073 exitBlock); 3071 exitBlock);
3074 kernelBuilder.inTryStatement = previouslyInTryStatement; 3072 kernelBuilder.inTryStatement = previouslyInTryStatement;
3075 } 3073 }
3076 } 3074 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698