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

Side by Side Diff: pkg/compiler/lib/src/kernel/kernel_visitor.dart

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Fixes after rebase. Created 3 years, 9 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 import 'package:kernel/frontend/accessors.dart' 6 import 'package:kernel/frontend/accessors.dart'
7 show 7 show
8 Accessor, 8 Accessor,
9 IndexAccessor, 9 IndexAccessor,
10 NullAwarePropertyAccessor, 10 NullAwarePropertyAccessor,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 DoWhile, 98 DoWhile,
99 DottedName, 99 DottedName,
100 EmptyStatement, 100 EmptyStatement,
101 Enum, 101 Enum,
102 Expression, 102 Expression,
103 ExpressionStatement, 103 ExpressionStatement,
104 For, 104 For,
105 ForIn, 105 ForIn,
106 FunctionDeclaration, 106 FunctionDeclaration,
107 FunctionExpression, 107 FunctionExpression,
108 FunctionTypeAnnotation,
108 Identifier, 109 Identifier,
109 If, 110 If,
110 Label, 111 Label,
111 LabeledStatement, 112 LabeledStatement,
112 LiteralBool, 113 LiteralBool,
113 LiteralDouble, 114 LiteralDouble,
114 LiteralInt, 115 LiteralInt,
115 LiteralList, 116 LiteralList,
116 LiteralMap, 117 LiteralMap,
117 LiteralMapEntry, 118 LiteralMapEntry,
118 LiteralNull, 119 LiteralNull,
119 LiteralString, 120 LiteralString,
120 LiteralSymbol, 121 LiteralSymbol,
121 Metadata, 122 Metadata,
122 NamedArgument, 123 NamedArgument,
123 NewExpression, 124 NewExpression,
124 Node, 125 Node,
125 NodeList, 126 NodeList,
127 NominalTypeAnnotation,
126 Operator, 128 Operator,
127 ParenthesizedExpression, 129 ParenthesizedExpression,
128 RedirectingFactoryBody, 130 RedirectingFactoryBody,
129 Rethrow, 131 Rethrow,
130 Return, 132 Return,
131 Send, 133 Send,
132 SendSet, 134 SendSet,
133 Statement, 135 Statement,
134 StringInterpolation, 136 StringInterpolation,
135 StringInterpolationPart, 137 StringInterpolationPart,
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 } 1116 }
1115 if (node.finallyBlock != null) { 1117 if (node.finallyBlock != null) {
1116 result = 1118 result =
1117 new ir.TryFinally(result, buildStatementInBlock(node.finallyBlock)); 1119 new ir.TryFinally(result, buildStatementInBlock(node.finallyBlock));
1118 } 1120 }
1119 return buildBreakTarget(result, node, elements.getTargetDefinition(node)); 1121 return buildBreakTarget(result, node, elements.getTargetDefinition(node));
1120 } 1122 }
1121 1123
1122 @override 1124 @override
1123 visitTypeAnnotation(TypeAnnotation node) { 1125 visitTypeAnnotation(TypeAnnotation node) {
1124 // Shouldn't be called, as the resolver have already resolved types and 1126 // Shouldn't be called, as the resolver has already resolved types and
1125 // created [DartType] objects. 1127 // created [DartType] objects.
1126 return internalError(node, "TypeAnnotation"); 1128 return internalError(node, "TypeAnnotation");
1127 } 1129 }
1128 1130
1129 @override 1131 @override
1132 visitNominalTypeAnnotation(NominalTypeAnnotation node) {
1133 // Shouldn't be called, as the resolver has already resolved types and
1134 // created [DartType] objects.
1135 return internalError(node, "NominalTypeAnnotation");
1136 }
1137
1138 @override
1139 visitFunctionTypeAnnotation(FunctionTypeAnnotation node) {
1140 // Shouldn't be called, as the resolver has already resolved types and
1141 // created [DartType] objects.
1142 return internalError(node, "FunctionTypeAnnotation");
1143 }
1144
1145 @override
1130 visitTypeVariable(TypeVariable node) { 1146 visitTypeVariable(TypeVariable node) {
1131 // Shouldn't be called, as the resolver have already resolved types and 1147 // Shouldn't be called, as the resolver has already resolved types and
1132 // created [DartType] objects. 1148 // created [DartType] objects.
1133 return internalError(node, "TypeVariable"); 1149 return internalError(node, "TypeVariable");
1134 } 1150 }
1135 1151
1136 @override 1152 @override
1137 ir.Statement visitWhile(While node) { 1153 ir.Statement visitWhile(While node) {
1138 ir.Expression condition = visitForValue(node.condition); 1154 ir.Expression condition = visitForValue(node.condition);
1139 JumpTarget jumpTarget = elements.getTargetDefinition(node); 1155 JumpTarget jumpTarget = elements.getTargetDefinition(node);
1140 ir.Statement body = 1156 ir.Statement body =
1141 buildContinueTarget(buildStatementInBlock(node.body), node, jumpTarget); 1157 buildContinueTarget(buildStatementInBlock(node.body), node, jumpTarget);
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 : this(null, true, node, initializers); 2940 : this(null, true, node, initializers);
2925 2941
2926 accept(ir.Visitor v) => throw "unsupported"; 2942 accept(ir.Visitor v) => throw "unsupported";
2927 2943
2928 visitChildren(ir.Visitor v) => throw "unsupported"; 2944 visitChildren(ir.Visitor v) => throw "unsupported";
2929 2945
2930 String toString() { 2946 String toString() {
2931 return "IrFunction($kind, $isConstructor, $node, $initializers)"; 2947 return "IrFunction($kind, $isConstructor, $node, $initializers)";
2932 } 2948 }
2933 } 2949 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698