| 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 // Tests super setter where the HInvokeSuper is using interceptor aka | 8 // Tests super setter where the HInvokeSuper is using interceptor aka |
| 9 // explicit-receiver calling convention. | 9 // explicit-receiver calling convention. |
| 10 | 10 |
| 11 @Native("A") | 11 @Native("A") |
| 12 class A { | 12 class A { |
| 13 var foo; | 13 var foo; |
| 14 get_foo() => foo; | 14 get_foo() => foo; |
| 15 set bar(value) => foo = value; | 15 set bar(value) => foo = value; |
| 16 } | 16 } |
| 17 | 17 |
| 18 @Native("B") | 18 @Native("B") |
| 19 class B extends A { | 19 class B extends A { |
| 20 set foo(value) { | 20 set foo(value) { |
| 21 super.foo = value; | 21 super.foo = value; |
| 22 } | 22 } |
| 23 |
| 23 get foo => super.foo; | 24 get foo => super.foo; |
| 24 } | 25 } |
| 25 | 26 |
| 26 class C { | 27 class C { |
| 27 var foo; | 28 var foo; |
| 28 get_foo() => foo; | 29 get_foo() => foo; |
| 29 set bar(value) => foo = value; | 30 set bar(value) => foo = value; |
| 30 } | 31 } |
| 31 | 32 |
| 32 class D extends C { | 33 class D extends C { |
| 33 set foo(value) { | 34 set foo(value) { |
| 34 super.foo = value; | 35 super.foo = value; |
| 35 } | 36 } |
| 37 |
| 36 get foo => super.foo; | 38 get foo => super.foo; |
| 37 } | 39 } |
| 38 | 40 |
| 39 makeA() native; | 41 makeA() native ; |
| 40 makeB() native; | 42 makeB() native ; |
| 41 | 43 |
| 42 void setup() native """ | 44 void setup() native """ |
| 43 // 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. |
| 44 function A(){} | 46 function A(){} |
| 45 function B(){} | 47 function B(){} |
| 46 makeA = function(){return new A}; | 48 makeA = function(){return new A}; |
| 47 makeB = function(){return new B}; | 49 makeB = function(){return new B}; |
| 48 """; | 50 """; |
| 49 | 51 |
| 50 testThing(a) { | 52 testThing(a) { |
| 51 a.foo = 123; | 53 a.foo = 123; |
| 52 Expect.equals(123, a.foo); | 54 Expect.equals(123, a.foo); |
| 53 Expect.equals(123, a.get_foo()); | 55 Expect.equals(123, a.get_foo()); |
| 54 | 56 |
| 55 a.bar = 234; | 57 a.bar = 234; |
| 56 Expect.equals(234, a.foo); | 58 Expect.equals(234, a.foo); |
| 57 Expect.equals(234, a.get_foo()); | 59 Expect.equals(234, a.get_foo()); |
| 58 } | 60 } |
| 59 | 61 |
| 60 main() { | 62 main() { |
| 61 setup(); | 63 setup(); |
| 62 var things = [makeA(), makeB(), new C(), new D()]; | 64 var things = [makeA(), makeB(), new C(), new D()]; |
| 63 var test = testThing; | 65 var test = testThing; |
| 64 test(things[0]); | 66 test(things[0]); |
| 65 test(things[1]); | 67 test(things[1]); |
| 66 test(things[2]); | 68 test(things[2]); |
| 67 test(things[3]); | 69 test(things[3]); |
| 68 } | 70 } |
| OLD | NEW |