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 "native_testing.dart"; | 5 import "dart:_js_helper"; |
| 6 import "package:expect/expect.dart"; |
6 | 7 |
7 // Tests super setter where the HInvokeSuper is using interceptor aka | 8 // Tests super setter where the HInvokeSuper is using interceptor aka |
8 // explicit-receiver calling convention. | 9 // explicit-receiver calling convention. |
9 | 10 |
10 @Native("A") | 11 @Native("A") |
11 class A { | 12 class A { |
12 var foo; | 13 var foo; |
13 get_foo() => foo; | 14 get_foo() => foo; |
14 set bar(value) => foo = value; | 15 set bar(value) => foo = value; |
15 } | 16 } |
(...skipping 23 matching lines...) Expand all Loading... |
39 | 40 |
40 makeA() native ; | 41 makeA() native ; |
41 makeB() native ; | 42 makeB() native ; |
42 | 43 |
43 void setup() native """ | 44 void setup() native """ |
44 // This code is all inside 'setup' and so not accesible from the global scope. | 45 // This code is all inside 'setup' and so not accesible from the global scope. |
45 function A(){} | 46 function A(){} |
46 function B(){} | 47 function B(){} |
47 makeA = function(){return new A}; | 48 makeA = function(){return new A}; |
48 makeB = function(){return new B}; | 49 makeB = function(){return new B}; |
49 self.nativeConstructor(A); | |
50 self.nativeConstructor(B); | |
51 """; | 50 """; |
52 | 51 |
53 testThing(a) { | 52 testThing(a) { |
54 a.foo = 123; | 53 a.foo = 123; |
55 Expect.equals(123, a.foo); | 54 Expect.equals(123, a.foo); |
56 Expect.equals(123, a.get_foo()); | 55 Expect.equals(123, a.get_foo()); |
57 | 56 |
58 a.bar = 234; | 57 a.bar = 234; |
59 Expect.equals(234, a.foo); | 58 Expect.equals(234, a.foo); |
60 Expect.equals(234, a.get_foo()); | 59 Expect.equals(234, a.get_foo()); |
61 } | 60 } |
62 | 61 |
63 main() { | 62 main() { |
64 nativeTesting(); | |
65 setup(); | 63 setup(); |
66 var things = [makeA(), makeB(), new C(), new D()]; | 64 var things = [makeA(), makeB(), new C(), new D()]; |
67 var test = testThing; | 65 var test = testThing; |
68 test(things[0]); | 66 test(things[0]); |
69 test(things[1]); | 67 test(things[1]); |
70 test(things[2]); | 68 test(things[2]); |
71 test(things[3]); | 69 test(things[3]); |
72 } | 70 } |
OLD | NEW |