Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: tests/compiler/dart2js_native/native_mirror_test.dart

Issue 383413003: Add @Native(...) annotation for native class names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "package:expect/expect.dart"; 12 import "package:expect/expect.dart";
13 import "dart:_js_helper";
13 import "dart:mirrors"; 14 import "dart:mirrors";
14 15
15 class A native "A" { 16 @Native("A")
17 class A {
16 final foo; 18 final foo;
17 } 19 }
18 20
19 class B { 21 class B {
20 String foo; 22 String foo;
21 } 23 }
22 24
23 main() { 25 main() {
24 var b = new B(); 26 var b = new B();
25 reflect(b).setField(new Symbol("foo"), "bar"); 27 reflect(b).setField(new Symbol("foo"), "bar");
26 Expect.equals("bar", b.foo); 28 Expect.equals("bar", b.foo);
27 } 29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698