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 import "dart:_js_helper"; |
5 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
6 | 7 |
7 // Verify that we can have fields with names that start with g and s even | 8 // Verify that we can have fields with names that start with g and s even |
8 // though those names are reserved for getters and setters in minified mode. | 9 // though those names are reserved for getters and setters in minified mode. |
9 | 10 |
10 // Note: this works because end and send are both in the list of | 11 // Note: this works because end and send are both in the list of |
11 // reservedNativeProperties. In general we don't check arbitrary | 12 // reservedNativeProperties. In general we don't check arbitrary |
12 // names for clashes because it's hard - subclasses can force superclasses | 13 // names for clashes because it's hard - subclasses can force superclasses |
13 // to rename getters, and that can force unrelated classes to change their | 14 // to rename getters, and that can force unrelated classes to change their |
14 // getters too if they have a property that has the same name. | 15 // getters too if they have a property that has the same name. |
15 class A native "A" { | 16 @Native("A") |
| 17 class A { |
16 int bar; | 18 int bar; |
17 int g; | 19 int g; |
18 int s; | 20 int s; |
19 int end; | 21 int end; |
20 int gend; | 22 int gend; |
21 int send; | 23 int send; |
22 int gettersCalled; | 24 int gettersCalled; |
23 int settersCalled; | 25 int settersCalled; |
24 } | 26 } |
25 | 27 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 Expect.equals(42, foo.send); | 81 Expect.equals(42, foo.send); |
80 Expect.equals(271, foo.bar = 271); | 82 Expect.equals(271, foo.bar = 271); |
81 Expect.equals(271, foo.g = 271); | 83 Expect.equals(271, foo.g = 271); |
82 Expect.equals(271, foo.s = 271); | 84 Expect.equals(271, foo.s = 271); |
83 Expect.equals(271, foo.end = 271); | 85 Expect.equals(271, foo.end = 271); |
84 Expect.equals(271, foo.gend = 271); | 86 Expect.equals(271, foo.gend = 271); |
85 Expect.equals(271, foo.send = 271); | 87 Expect.equals(271, foo.send = 271); |
86 Expect.equals(6, foo.gettersCalled); | 88 Expect.equals(6, foo.gettersCalled); |
87 Expect.equals(6, foo.settersCalled); | 89 Expect.equals(6, foo.settersCalled); |
88 } | 90 } |
OLD | NEW |