| 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 // Properties on hidden native classes. | 5 // Properties on hidden native classes. |
| 6 | 6 |
| 7 @native("*A") | 7 @native("*A") |
| 8 class A { | 8 class A { |
| 9 | 9 |
| 10 // Setters and getters should be similar to these methods: | 10 // Setters and getters should be similar to these methods: |
| 11 @native('return this._x;') | 11 @native('return this._x;') |
| 12 int getX(); | 12 int getX(); |
| 13 | 13 |
| 14 @native('this._x = value;') | 14 @native('this._x = value;') |
| 15 void setX(int value); | 15 void setX(int value); |
| 16 | 16 |
| 17 @native | 17 @native |
| 18 int get X(); | 18 int get X; |
| 19 | 19 |
| 20 @native | 20 @native |
| 21 set X(int value); | 21 set X(int value); |
| 22 | 22 |
| 23 @native | 23 @native |
| 24 int get Y(); | 24 int get Y; |
| 25 | 25 |
| 26 @native | 26 @native |
| 27 set Y(int value); | 27 set Y(int value); |
| 28 | 28 |
| 29 @native('return this._z;') | 29 @native('return this._z;') |
| 30 int get Z(); | 30 int get Z; |
| 31 | 31 |
| 32 @native('this._z = value;') | 32 @native('this._z = value;') |
| 33 set Z(int value); | 33 set Z(int value); |
| 34 } | 34 } |
| 35 | 35 |
| 36 @native | 36 @native |
| 37 A makeA() { return new A(); } | 37 A makeA() { return new A(); } |
| 38 | 38 |
| 39 @native(""" | 39 @native(""" |
| 40 function A() {} | 40 function A() {} |
| (...skipping 17 matching lines...) Expand all Loading... |
| 58 Expect.equals(5, a.getX()); | 58 Expect.equals(5, a.getX()); |
| 59 | 59 |
| 60 a.X = 10; | 60 a.X = 10; |
| 61 a.Y = 20; | 61 a.Y = 20; |
| 62 a.Z = 30; | 62 a.Z = 30; |
| 63 | 63 |
| 64 Expect.equals(10, a.X); | 64 Expect.equals(10, a.X); |
| 65 Expect.equals(20, a.Y); | 65 Expect.equals(20, a.Y); |
| 66 Expect.equals(30, a.Z); | 66 Expect.equals(30, a.Z); |
| 67 } | 67 } |
| OLD | NEW |