OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Make sure we can have a native with a name that is a JavaScript keyword. | 5 // Make sure we can have a native with a name that is a JavaScript keyword. |
6 | 6 |
7 @native("*A") | 7 @native("*A") |
8 class A { | 8 class A { |
9 @native int delete(); | 9 @native int delete(); |
10 } | 10 } |
11 | 11 |
12 @native A makeA() { return new A(); } | 12 @native A makeA() { return new A(); } |
13 | 13 |
14 @native(""" | 14 @native(""" |
15 function A() {} | 15 function A() {} |
16 A.prototype.delete = function() { return 87; }; | 16 A.prototype.delete = function() { return 87; }; |
17 | 17 |
18 makeA = function(){return new A;}; | 18 makeA = function(){return new A;}; |
19 """) | 19 """) |
20 void setup(); | 20 void setup(); |
21 | 21 |
22 | 22 |
23 main() { | 23 main() { |
24 setup(); | 24 setup(); |
25 | 25 |
26 var a = makeA(); | 26 var a = makeA(); |
27 Expect.equals(87, a.delete()); | 27 Expect.equals(87, a.delete()); |
28 A aa = a; | 28 A aa = a; |
29 Expect.equals(87, aa.delete()); | 29 Expect.equals(87, aa.delete()); |
30 } | 30 } |
OLD | NEW |