| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 "dart:_js_helper"; | 5 import "dart:_js_helper"; |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 | 7 |
| 8 // Test for dartNativeDispatchHooksTransformer | 8 // Test for dartNativeDispatchHooksTransformer |
| 9 // - uncached, instance, leaf and interior caching modes. | 9 // - uncached, instance, leaf and interior caching modes. |
| 10 // - composition of getTag. | 10 // - composition of getTag. |
| 11 | 11 |
| 12 @Native("T1A") | 12 @Native("T1A") |
| 13 class T1A { | 13 class T1A { |
| 14 foo() native; | 14 foo() native ; |
| 15 } | 15 } |
| 16 | 16 |
| 17 @Native("T1B") | 17 @Native("T1B") |
| 18 class T1B { | 18 class T1B { |
| 19 foo() native; | 19 foo() native ; |
| 20 } | 20 } |
| 21 | 21 |
| 22 @Native("T1C") | 22 @Native("T1C") |
| 23 class T1C { | 23 class T1C { |
| 24 foo() native; | 24 foo() native ; |
| 25 } | 25 } |
| 26 | 26 |
| 27 @Native("T1D") | 27 @Native("T1D") |
| 28 class T1D { | 28 class T1D { |
| 29 foo() native; | 29 foo() native ; |
| 30 } | 30 } |
| 31 | 31 |
| 32 makeT1A() native; | 32 makeT1A() native ; |
| 33 makeT1B() native; | 33 makeT1B() native ; |
| 34 makeT1C() native; | 34 makeT1C() native ; |
| 35 makeT1D() native; | 35 makeT1D() native ; |
| 36 | 36 |
| 37 int getTagCallCount() native; | 37 int getTagCallCount() native ; |
| 38 void clearTagCallCount() native; | 38 void clearTagCallCount() native ; |
| 39 | 39 |
| 40 void setup() native r''' | 40 void setup() native r''' |
| 41 function T1A() { this.v = "a"; } | 41 function T1A() { this.v = "a"; } |
| 42 function T1B() { this.v = "b"; } | 42 function T1B() { this.v = "b"; } |
| 43 function T1C() { this.v = "c"; } | 43 function T1C() { this.v = "c"; } |
| 44 function T1D() { this.v = "d"; } | 44 function T1D() { this.v = "d"; } |
| 45 | 45 |
| 46 // T1B, T1C and T1D extend T1A in the implementation but not the declared types. | 46 // T1B, T1C and T1D extend T1A in the implementation but not the declared types. |
| 47 // T1A must not be leaf-cached otherwise we will pick up the interceptor for T1A | 47 // T1A must not be leaf-cached otherwise we will pick up the interceptor for T1A |
| 48 // when looking for the dispatch record for an uncached or not-yet-cached T1B, | 48 // when looking for the dispatch record for an uncached or not-yet-cached T1B, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 '2 = 1 fresh instance + 1 uncached (+ 2 proto cached)'); | 138 '2 = 1 fresh instance + 1 uncached (+ 2 proto cached)'); |
| 139 | 139 |
| 140 clearTagCallCount(); | 140 clearTagCallCount(); |
| 141 Expect.equals("aA", inscrutable(t1a).foo(), 't1a is T1A'); | 141 Expect.equals("aA", inscrutable(t1a).foo(), 't1a is T1A'); |
| 142 Expect.equals("bB", inscrutable(t1b).foo(), 't1b is T1B'); | 142 Expect.equals("bB", inscrutable(t1b).foo(), 't1b is T1B'); |
| 143 Expect.equals("cC", inscrutable(t1c).foo(), 't1c is T1C'); | 143 Expect.equals("cC", inscrutable(t1c).foo(), 't1c is T1C'); |
| 144 Expect.equals("dD", inscrutable(t1d).foo(), 't1d is T1D'); | 144 Expect.equals("dD", inscrutable(t1d).foo(), 't1d is T1D'); |
| 145 Expect.equals(1, getTagCallCount(), | 145 Expect.equals(1, getTagCallCount(), |
| 146 '1 = 2 proto cached + 1 instance cached + 1 uncached'); | 146 '1 = 2 proto cached + 1 instance cached + 1 uncached'); |
| 147 } | 147 } |
| OLD | NEW |