| 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:mirrors'; | 5 import 'dart:mirrors'; |
| 6 import 'native_testing.dart'; | 6 import "dart:_js_helper"; |
| 7 import "package:expect/expect.dart"; |
| 7 | 8 |
| 8 @Native("B") | 9 @Native("B") |
| 9 class B { | 10 class B { |
| 10 // Having this field in a native class will generate accessors with | 11 // Having this field in a native class will generate accessors with |
| 11 // the interceptor calling convention. | 12 // the interceptor calling convention. |
| 12 var f; | 13 var f; |
| 13 } | 14 } |
| 14 | 15 |
| 15 class A { | 16 class A { |
| 16 int f; | 17 int f; |
| 17 } | 18 } |
| 18 | 19 |
| 19 const symF = const Symbol('f'); | 20 const symF = const Symbol('f'); |
| 20 | 21 |
| 21 main() { | 22 main() { |
| 22 JS('B', '(null)'); // B appears to be created. | |
| 23 var a = new A(); | 23 var a = new A(); |
| 24 | 24 |
| 25 InstanceMirror mirror = reflect(a); | 25 InstanceMirror mirror = reflect(a); |
| 26 mirror.setField(symF, 42); | 26 mirror.setField(symF, 42); |
| 27 Expect.equals(42, a.f); | 27 Expect.equals(42, a.f); |
| 28 | 28 |
| 29 mirror = mirror.getField(symF); | 29 mirror = mirror.getField(symF); |
| 30 Expect.equals(42, mirror.reflectee); | 30 Expect.equals(42, mirror.reflectee); |
| 31 } | 31 } |
| OLD | NEW |