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

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: Add new test and remove generated tests for this CL. Created 3 years, 10 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 DoWhile, 97 DoWhile,
98 DottedName, 98 DottedName,
99 EmptyStatement, 99 EmptyStatement,
100 Enum, 100 Enum,
101 Expression, 101 Expression,
102 ExpressionStatement, 102 ExpressionStatement,
103 For, 103 For,
104 ForIn, 104 ForIn,
105 FunctionDeclaration, 105 FunctionDeclaration,
106 FunctionExpression, 106 FunctionExpression,
107 FunctionTypeAnnotation,
107 Identifier, 108 Identifier,
108 If, 109 If,
109 Label, 110 Label,
110 LabeledStatement, 111 LabeledStatement,
111 LiteralBool, 112 LiteralBool,
112 LiteralDouble, 113 LiteralDouble,
113 LiteralInt, 114 LiteralInt,
114 LiteralList, 115 LiteralList,
115 LiteralMap, 116 LiteralMap,
116 LiteralMapEntry, 117 LiteralMapEntry,
117 LiteralNull, 118 LiteralNull,
118 LiteralString, 119 LiteralString,
119 LiteralSymbol, 120 LiteralSymbol,
120 Metadata, 121 Metadata,
121 NamedArgument, 122 NamedArgument,
122 NewExpression, 123 NewExpression,
123 Node, 124 Node,
124 NodeList, 125 NodeList,
126 NominalTypeAnnotation,
125 Operator, 127 Operator,
126 ParenthesizedExpression, 128 ParenthesizedExpression,
127 RedirectingFactoryBody, 129 RedirectingFactoryBody,
128 Rethrow, 130 Rethrow,
129 Return, 131 Return,
130 Send, 132 Send,
131 SendSet, 133 SendSet,
132 Statement, 134 Statement,
133 StringInterpolation, 135 StringInterpolation,
134 StringInterpolationPart, 136 StringInterpolationPart,
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 } 1091 }
1090 if (node.finallyBlock != null) { 1092 if (node.finallyBlock != null) {
1091 result = 1093 result =
1092 new ir.TryFinally(result, buildStatementInBlock(node.finallyBlock)); 1094 new ir.TryFinally(result, buildStatementInBlock(node.finallyBlock));
1093 } 1095 }
1094 return buildBreakTarget(result, node, elements.getTargetDefinition(node)); 1096 return buildBreakTarget(result, node, elements.getTargetDefinition(node));
1095 } 1097 }
1096 1098
1097 @override 1099 @override
1098 visitTypeAnnotation(TypeAnnotation node) { 1100 visitTypeAnnotation(TypeAnnotation node) {
1099 // Shouldn't be called, as the resolver have already resolved types and 1101 // Shouldn't be called, as the resolver has already resolved types and
1100 // created [DartType] objects. 1102 // created [DartType] objects.
1101 return internalError(node, "TypeAnnotation"); 1103 return internalError(node, "TypeAnnotation");
1102 } 1104 }
1103 1105
1104 @override 1106 @override
1107 visitNominalTypeAnnotation(NominalTypeAnnotation node) {
1108 // Shouldn't be called, as the resolver has already resolved types and
1109 // created [DartType] objects.
1110 return internalError(node, "NominalTypeAnnotation");
1111 }
1112
1113 @override
1114 visitFunctionTypeAnnotation(FunctionTypeAnnotation node) {
1115 // Shouldn't be called, as the resolver has already resolved types and
1116 // created [DartType] objects.
1117 return internalError(node, "FunctionTypeAnnotation");
1118 }
1119
1120 @override
1105 visitTypeVariable(TypeVariable node) { 1121 visitTypeVariable(TypeVariable node) {
1106 // Shouldn't be called, as the resolver have already resolved types and 1122 // Shouldn't be called, as the resolver has already resolved types and
1107 // created [DartType] objects. 1123 // created [DartType] objects.
1108 return internalError(node, "TypeVariable"); 1124 return internalError(node, "TypeVariable");
1109 } 1125 }
1110 1126
1111 @override 1127 @override
1112 ir.Statement visitWhile(While node) { 1128 ir.Statement visitWhile(While node) {
1113 ir.Expression condition = visitForValue(node.condition); 1129 ir.Expression condition = visitForValue(node.condition);
1114 JumpTarget jumpTarget = elements.getTargetDefinition(node); 1130 JumpTarget jumpTarget = elements.getTargetDefinition(node);
1115 ir.Statement body = 1131 ir.Statement body =
1116 buildContinueTarget(buildStatementInBlock(node.body), node, jumpTarget); 1132 buildContinueTarget(buildStatementInBlock(node.body), node, jumpTarget);
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
2862 : this(null, true, node, initializers); 2878 : this(null, true, node, initializers);
2863 2879
2864 accept(ir.Visitor v) => throw "unsupported"; 2880 accept(ir.Visitor v) => throw "unsupported";
2865 2881
2866 visitChildren(ir.Visitor v) => throw "unsupported"; 2882 visitChildren(ir.Visitor v) => throw "unsupported";
2867 2883
2868 String toString() { 2884 String toString() {
2869 return "IrFunction($kind, $isConstructor, $node, $initializers)"; 2885 return "IrFunction($kind, $isConstructor, $node, $initializers)";
2870 } 2886 }
2871 } 2887 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698