| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 // Regression test for dart2js that used to miscompile |
| 6 // [A.visitInvokeDynamicMethod]. |
| 7 |
| 8 import "package:expect/expect.dart"; |
| 9 |
| 10 var a = 2; |
| 11 |
| 12 class Tupe { |
| 13 const Tupe(); |
| 14 get instructionType => a == 2 ? this : new A(); |
| 15 refine(a, b) => '$a$b'; |
| 16 } |
| 17 |
| 18 class Node { |
| 19 final selector = null; |
| 20 var inputs = {"a": const Tupe(), "b": const Tupe() }; |
| 21 bool isCallOnInterceptor; |
| 22 |
| 23 getDartReceiver() { |
| 24 return isCallOnInterceptor ? inputs["a"] : inputs["b"]; |
| 25 } |
| 26 } |
| 27 |
| 28 class A { |
| 29 visitInvokeDynamicMethod(node) { |
| 30 var receiverType = node.getDartReceiver().instructionType; |
| 31 return receiverType.refine(node.selector, node.selector); |
| 32 } |
| 33 } |
| 34 |
| 35 main() { |
| 36 Expect.equals('nullnull', |
| 37 [new A()].last.visitInvokeDynamicMethod(new Node())); |
| 38 } |
| OLD | NEW |