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 '../compiler.dart'; | 8 import '../compiler.dart'; |
9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
11 import '../elements/elements.dart'; | 11 import '../elements/elements.dart'; |
12 import '../js_backend/backend.dart' show JavaScriptBackend; | 12 import '../js_backend/backend.dart' show JavaScriptBackend; |
13 import '../kernel/kernel.dart'; | 13 import '../kernel/kernel.dart'; |
| 14 import '../kernel/kernel_debug.dart'; |
14 import '../kernel/kernel_visitor.dart'; | 15 import '../kernel/kernel_visitor.dart'; |
15 import '../resolution/registry.dart' show ResolutionWorldImpactBuilder; | 16 import '../resolution/registry.dart' show ResolutionWorldImpactBuilder; |
16 import '../universe/feature.dart'; | 17 import '../universe/feature.dart'; |
| 18 import '../universe/selector.dart'; |
17 import '../universe/use.dart'; | 19 import '../universe/use.dart'; |
18 | 20 |
19 import 'kernel_ast_adapter.dart'; | 21 import 'kernel_ast_adapter.dart'; |
20 import '../common/resolution.dart'; | 22 import '../common/resolution.dart'; |
21 | 23 |
22 /// Computes the [ResolutionImpact] for [resolvedAst] through kernel. | 24 /// Computes the [ResolutionImpact] for [resolvedAst] through kernel. |
23 ResolutionImpact build(Compiler compiler, ResolvedAst resolvedAst) { | 25 ResolutionImpact build(Compiler compiler, ResolvedAst resolvedAst) { |
24 AstElement element = resolvedAst.element.implementation; | 26 AstElement element = resolvedAst.element.implementation; |
25 JavaScriptBackend backend = compiler.backend; | 27 JavaScriptBackend backend = compiler.backend; |
26 Kernel kernel = backend.kernelTask.kernel; | 28 Kernel kernel = backend.kernelTask.kernel; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 216 |
215 @override | 217 @override |
216 void visitMethodInvocation(ir.MethodInvocation invocation) { | 218 void visitMethodInvocation(ir.MethodInvocation invocation) { |
217 invocation.receiver.accept(this); | 219 invocation.receiver.accept(this); |
218 _visitArguments(invocation.arguments); | 220 _visitArguments(invocation.arguments); |
219 impactBuilder.registerDynamicUse( | 221 impactBuilder.registerDynamicUse( |
220 new DynamicUse(astAdapter.getSelector(invocation), null)); | 222 new DynamicUse(astAdapter.getSelector(invocation), null)); |
221 } | 223 } |
222 | 224 |
223 @override | 225 @override |
| 226 void visitPropertyGet(ir.PropertyGet node) { |
| 227 node.receiver.accept(this); |
| 228 impactBuilder.registerDynamicUse(new DynamicUse( |
| 229 new Selector.getter(astAdapter.getName(node.name)), null)); |
| 230 } |
| 231 |
| 232 @override |
| 233 void visitPropertySet(ir.PropertySet node) { |
| 234 node.receiver.accept(this); |
| 235 node.value.accept(this); |
| 236 impactBuilder.registerDynamicUse(new DynamicUse( |
| 237 new Selector.setter(astAdapter.getName(node.name)), null)); |
| 238 } |
| 239 |
| 240 @override |
224 void visitNot(ir.Not not) { | 241 void visitNot(ir.Not not) { |
225 not.operand.accept(this); | 242 not.operand.accept(this); |
226 } | 243 } |
| 244 |
| 245 @override |
| 246 void visitAssertStatement(ir.AssertStatement node) { |
| 247 impactBuilder.registerFeature( |
| 248 node.message != null ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT); |
| 249 node.visitChildren(this); |
| 250 } |
| 251 |
| 252 @override |
| 253 void defaultNode(ir.Node node) => node.visitChildren(this); |
227 } | 254 } |
OLD | NEW |