| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // need to follow the type arguments passed to A.regular and A.redirect | 292 // need to follow the type arguments passed to A.regular and A.redirect |
| 293 // to B. Currently, we only do this soundly if we register A<int> and | 293 // to B. Currently, we only do this soundly if we register A<int> and |
| 294 // A<String> as instantiated. We should instead register that A.T is | 294 // A<String> as instantiated. We should instead register that A.T is |
| 295 // instantiated as int and String. | 295 // instantiated as int and String. |
| 296 handleNew(node, node.target, isConst: node.isConst); | 296 handleNew(node, node.target, isConst: node.isConst); |
| 297 } else { | 297 } else { |
| 298 _visitArguments(node.arguments); | 298 _visitArguments(node.arguments); |
| 299 impactBuilder.registerStaticUse(new StaticUse.staticInvoke( | 299 impactBuilder.registerStaticUse(new StaticUse.staticInvoke( |
| 300 target, astAdapter.getCallStructure(node.arguments))); | 300 target, astAdapter.getCallStructure(node.arguments))); |
| 301 } | 301 } |
| 302 switch (astAdapter.getForeignKind(node)) { |
| 303 case ForeignKind.JS: |
| 304 impactBuilder |
| 305 .registerNativeData(astAdapter.getNativeBehaviorForJsCall(node)); |
| 306 break; |
| 307 case ForeignKind.JS_BUILTIN: |
| 308 impactBuilder.registerNativeData( |
| 309 astAdapter.getNativeBehaviorForJsBuiltinCall(node)); |
| 310 break; |
| 311 case ForeignKind.JS_EMBEDDED_GLOBAL: |
| 312 impactBuilder.registerNativeData( |
| 313 astAdapter.getNativeBehaviorForJsEmbeddedGlobalCall(node)); |
| 314 break; |
| 315 case ForeignKind.JS_INTERCEPTOR_CONSTANT: |
| 316 if (node.arguments.positional.length != 1 || |
| 317 node.arguments.named.isNotEmpty) { |
| 318 astAdapter.reporter.reportErrorMessage(CURRENT_ELEMENT_SPANNABLE, |
| 319 MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); |
| 320 } |
| 321 ir.Node argument = node.arguments.positional.first; |
| 322 if (argument is ir.TypeLiteral && argument.type is ir.InterfaceType) { |
| 323 impactBuilder.registerTypeUse( |
| 324 new TypeUse.instantiation(astAdapter.getDartType(argument.type))); |
| 325 } |
| 326 break; |
| 327 case ForeignKind.NONE: |
| 328 break; |
| 329 } |
| 302 } | 330 } |
| 303 | 331 |
| 304 @override | 332 @override |
| 305 void visitStaticGet(ir.StaticGet node) { | 333 void visitStaticGet(ir.StaticGet node) { |
| 306 ir.Member target = node.target; | 334 ir.Member target = node.target; |
| 307 Element element = astAdapter.getElement(target).declaration; | 335 Element element = astAdapter.getElement(target).declaration; |
| 308 if (target is ir.Procedure && target.kind == ir.ProcedureKind.Method) { | 336 if (target is ir.Procedure && target.kind == ir.ProcedureKind.Method) { |
| 309 impactBuilder.registerStaticUse(new StaticUse.staticTearOff(element)); | 337 impactBuilder.registerStaticUse(new StaticUse.staticTearOff(element)); |
| 310 } else { | 338 } else { |
| 311 impactBuilder.registerStaticUse(new StaticUse.staticGet(element)); | 339 impactBuilder.registerStaticUse(new StaticUse.staticGet(element)); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 Element target = astAdapter.getElement(node.target).declaration; | 557 Element target = astAdapter.getElement(node.target).declaration; |
| 530 impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke( | 558 impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke( |
| 531 target, astAdapter.getCallStructure(node.arguments))); | 559 target, astAdapter.getCallStructure(node.arguments))); |
| 532 } | 560 } |
| 533 | 561 |
| 534 // TODO(johnniwinther): Make this throw and visit child nodes explicitly | 562 // TODO(johnniwinther): Make this throw and visit child nodes explicitly |
| 535 // instead to ensure that we don't visit unwanted parts of the ir. | 563 // instead to ensure that we don't visit unwanted parts of the ir. |
| 536 @override | 564 @override |
| 537 void defaultNode(ir.Node node) => node.visitChildren(this); | 565 void defaultNode(ir.Node node) => node.visitChildren(this); |
| 538 } | 566 } |
| OLD | NEW |