OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Intercepted members need to be accessed in a different way than normal | 5 // Intercepted members need to be accessed in a different way than normal |
6 // members. In this test the native class A (thus being intercepted) has a | 6 // members. In this test the native class A (thus being intercepted) has a |
7 // member "foo", that is final. Therefore only the getter needs to be | 7 // member "foo", that is final. Therefore only the getter needs to be |
8 // intercepted. Dart2js had a bug where it used the intercepted | 8 // intercepted. Dart2js had a bug where it used the intercepted |
9 // calling-convention for parts of the compiler, and the non-intercepted | 9 // calling-convention for parts of the compiler, and the non-intercepted |
10 // convention for others, making this fail. | 10 // convention for others, making this fail. |
11 | 11 |
12 import 'native_testing.dart'; | 12 import "package:expect/expect.dart"; |
13 import 'dart:_js_helper'; | 13 import "dart:_js_helper"; |
14 import 'dart:mirrors'; | 14 import "dart:mirrors"; |
15 | 15 |
16 @Native("A") | 16 @Native("A") |
17 class A { | 17 class A { |
18 final foo; | 18 final foo; |
19 } | 19 } |
20 | 20 |
21 class B { | 21 class B { |
22 String foo; | 22 String foo; |
23 } | 23 } |
24 | 24 |
25 main() { | 25 main() { |
26 var b = new B(); | 26 var b = new B(); |
27 reflect(b).setField(new Symbol("foo"), "bar"); | 27 reflect(b).setField(new Symbol("foo"), "bar"); |
28 Expect.equals("bar", b.foo); | 28 Expect.equals("bar", b.foo); |
29 } | 29 } |
OLD | NEW |