| OLD | NEW |
| 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart'; | 8 import '../common/names.dart'; |
| 9 import '../compiler.dart'; | 9 import '../compiler.dart'; |
| 10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 | 238 |
| 239 @override | 239 @override |
| 240 void visitStaticGet(ir.StaticGet node) { | 240 void visitStaticGet(ir.StaticGet node) { |
| 241 Element target = astAdapter.getElement(node.target).declaration; | 241 Element target = astAdapter.getElement(node.target).declaration; |
| 242 impactBuilder.registerStaticUse(new StaticUse.staticGet(target)); | 242 impactBuilder.registerStaticUse(new StaticUse.staticGet(target)); |
| 243 } | 243 } |
| 244 | 244 |
| 245 @override | 245 @override |
| 246 void visitMethodInvocation(ir.MethodInvocation invocation) { | 246 void visitMethodInvocation(ir.MethodInvocation invocation) { |
| 247 invocation.receiver.accept(this); | 247 var receiver = invocation.receiver; |
| 248 if (receiver is ir.VariableGet && |
| 249 receiver.variable.isFinal && |
| 250 receiver.variable.parent is ir.FunctionDeclaration) { |
| 251 // Invocation of a local function. No need for dynamic use. |
| 252 } else { |
| 253 invocation.receiver.accept(this); |
| 254 impactBuilder.registerDynamicUse( |
| 255 new DynamicUse(astAdapter.getSelector(invocation), null)); |
| 256 } |
| 248 _visitArguments(invocation.arguments); | 257 _visitArguments(invocation.arguments); |
| 249 impactBuilder.registerDynamicUse( | |
| 250 new DynamicUse(astAdapter.getSelector(invocation), null)); | |
| 251 } | 258 } |
| 252 | 259 |
| 253 @override | 260 @override |
| 254 void visitPropertyGet(ir.PropertyGet node) { | 261 void visitPropertyGet(ir.PropertyGet node) { |
| 255 node.receiver.accept(this); | 262 node.receiver.accept(this); |
| 256 impactBuilder.registerDynamicUse(new DynamicUse( | 263 impactBuilder.registerDynamicUse(new DynamicUse( |
| 257 new Selector.getter(astAdapter.getName(node.name)), null)); | 264 new Selector.getter(astAdapter.getName(node.name)), null)); |
| 258 } | 265 } |
| 259 | 266 |
| 260 @override | 267 @override |
| (...skipping 12 matching lines...) Expand all Loading... |
| 273 } | 280 } |
| 274 | 281 |
| 275 @override | 282 @override |
| 276 void visitStringConcatenation(ir.StringConcatenation node) { | 283 void visitStringConcatenation(ir.StringConcatenation node) { |
| 277 impactBuilder.registerFeature(Feature.STRING_INTERPOLATION); | 284 impactBuilder.registerFeature(Feature.STRING_INTERPOLATION); |
| 278 impactBuilder.registerFeature(Feature.STRING_JUXTAPOSITION); | 285 impactBuilder.registerFeature(Feature.STRING_JUXTAPOSITION); |
| 279 node.visitChildren(this); | 286 node.visitChildren(this); |
| 280 } | 287 } |
| 281 | 288 |
| 282 @override | 289 @override |
| 290 void visitFunctionDeclaration(ir.FunctionDeclaration node) { |
| 291 impactBuilder |
| 292 .registerStaticUse(new StaticUse.closure(astAdapter.getElement(node))); |
| 293 node.visitChildren(this); |
| 294 } |
| 295 |
| 296 @override |
| 283 void defaultNode(ir.Node node) => node.visitChildren(this); | 297 void defaultNode(ir.Node node) => node.visitChildren(this); |
| 284 } | 298 } |
| OLD | NEW |