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

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

Issue 2360773003: More kernel_impact. (Closed)
Patch Set: Updated cf. comments Created 4 years, 2 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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1138
1139 @override 1139 @override
1140 ir.MethodInvocation visitBinary( 1140 ir.MethodInvocation visitBinary(
1141 Send node, Node left, BinaryOperator operator, Node right, _) { 1141 Send node, Node left, BinaryOperator operator, Node right, _) {
1142 return associateNode( 1142 return associateNode(
1143 buildBinaryOperator(left, operator.selectorName, right), node); 1143 buildBinaryOperator(left, operator.selectorName, right), node);
1144 } 1144 }
1145 1145
1146 ir.Expression buildConstructorInvoke(NewExpression node, {bool isConst}) { 1146 ir.Expression buildConstructorInvoke(NewExpression node, {bool isConst}) {
1147 ConstructorElement constructor = elements[node.send]; 1147 ConstructorElement constructor = elements[node.send];
1148 ConstructorTarget target = 1148 ConstructorTarget target;
1149 kernel.computeEffectiveTarget(constructor, elements.getType(node)); 1149 if (isConst) {
1150 target =
1151 kernel.computeEffectiveTarget(constructor, elements.getType(node));
1152 } else {
1153 target = new ConstructorTarget(constructor, elements.getType(node));
1154 }
1150 NodeList arguments = node.send.argumentsNode; 1155 NodeList arguments = node.send.argumentsNode;
1151 if (kernel.isSyntheticError(target.element)) { 1156 if (kernel.isSyntheticError(target.element)) {
1152 return new ir.MethodInvocation(new ir.InvalidExpression(), 1157 return new ir.MethodInvocation(new ir.InvalidExpression(),
1153 kernel.irName("call", currentElement), buildArguments(arguments)); 1158 kernel.irName("call", currentElement), buildArguments(arguments));
1154 } 1159 }
1155 ir.InvocationExpression invoke = target.element.isGenerativeConstructor 1160 ir.InvocationExpression invoke = target.element.isGenerativeConstructor
1156 ? buildGenerativeConstructorInvoke(target.element, arguments, 1161 ? buildGenerativeConstructorInvoke(target.element, arguments,
1157 isConst: isConst) 1162 isConst: isConst)
1158 : buildStaticInvoke(target.element, arguments, isConst: isConst); 1163 : buildStaticInvoke(target.element, arguments, isConst: isConst);
1159 if (target.type.isInterfaceType) { 1164 if (target.type.isInterfaceType) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 @override 1204 @override
1200 ir.Expression visitClassTypeLiteralSet( 1205 ir.Expression visitClassTypeLiteralSet(
1201 SendSet node, ConstantExpression constant, Node rhs, _) { 1206 SendSet node, ConstantExpression constant, Node rhs, _) {
1202 return buildTypeLiteralSet(constant, rhs); 1207 return buildTypeLiteralSet(constant, rhs);
1203 } 1208 }
1204 1209
1205 @override 1210 @override
1206 ir.FunctionExpression visitClosureDeclaration(FunctionExpression node, 1211 ir.FunctionExpression visitClosureDeclaration(FunctionExpression node,
1207 LocalFunctionElement closure, NodeList parameters, Node body, _) { 1212 LocalFunctionElement closure, NodeList parameters, Node body, _) {
1208 return withCurrentElement(closure, () { 1213 return withCurrentElement(closure, () {
1209 return new ir.FunctionExpression(buildFunctionNode(closure, body)); 1214 ir.FunctionExpression function =
1215 new ir.FunctionExpression(buildFunctionNode(closure, body));
1216 kernel.localFunctions[closure] = function;
1217 return function;
1210 }); 1218 });
1211 } 1219 }
1212 1220
1213 @override 1221 @override
1214 ir.Expression visitCompoundIndexSet(SendSet node, Node receiver, Node index, 1222 ir.Expression visitCompoundIndexSet(SendSet node, Node receiver, Node index,
1215 AssignmentOperator operator, Node rhs, _) { 1223 AssignmentOperator operator, Node rhs, _) {
1216 return buildIndexAccessor(receiver, index).buildCompoundAssignment( 1224 return buildIndexAccessor(receiver, index).buildCompoundAssignment(
1217 kernel.irName(operator.selectorName, currentElement), 1225 kernel.irName(operator.selectorName, currentElement),
1218 visitForValue(rhs), 1226 visitForValue(rhs),
1219 voidContext: isVoidContext); 1227 voidContext: isVoidContext);
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2759 : this(null, true, node, initializers); 2767 : this(null, true, node, initializers);
2760 2768
2761 accept(ir.Visitor v) => throw "unsupported"; 2769 accept(ir.Visitor v) => throw "unsupported";
2762 2770
2763 visitChildren(ir.Visitor v) => throw "unsupported"; 2771 visitChildren(ir.Visitor v) => throw "unsupported";
2764 2772
2765 String toString() { 2773 String toString() {
2766 return "IrFunction($kind, $isConstructor, $node, $initializers)"; 2774 return "IrFunction($kind, $isConstructor, $node, $initializers)";
2767 } 2775 }
2768 } 2776 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_debug.dart ('k') | pkg/compiler/lib/src/resolution/variables.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698