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 // Regression test for Issue 9182. The generative constructor body function | 5 // Regression test for Issue 9182. The generative constructor body function |
6 // should not have the interceptor calling convention. | 6 // should not have the interceptor calling convention. |
7 | 7 |
| 8 import "dart:_js_helper"; |
8 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
9 | 10 |
10 class Foo native "A" { | 11 @Native("A") |
| 12 class Foo { |
11 factory Foo() => makeA(); | 13 factory Foo() => makeA(); |
12 // Ensure the instance method 'Bar' uses interceptor convention. | 14 // Ensure the instance method 'Bar' uses interceptor convention. |
13 Bar() => 123; | 15 Bar() => 123; |
14 } | 16 } |
15 | 17 |
16 class Bar { | 18 class Bar { |
17 var _x, _y; | 19 var _x, _y; |
18 // Generative constructor with body, having the same name as interceptor | 20 // Generative constructor with body, having the same name as interceptor |
19 // convention instance member. | 21 // convention instance member. |
20 Bar(x, y) { | 22 Bar(x, y) { |
(...skipping 14 matching lines...) Expand all Loading... |
35 | 37 |
36 var things = [new Foo(), new Bar(30, 40)]; | 38 var things = [new Foo(), new Bar(30, 40)]; |
37 var foo = things[0]; | 39 var foo = things[0]; |
38 var bar = things[1]; | 40 var bar = things[1]; |
39 | 41 |
40 Expect.equals(123, foo.Bar()); // Ensure that Foo.Bar is used. | 42 Expect.equals(123, foo.Bar()); // Ensure that Foo.Bar is used. |
41 | 43 |
42 Expect.equals(30, bar._x); | 44 Expect.equals(30, bar._x); |
43 Expect.equals(40, bar._y); | 45 Expect.equals(40, bar._y); |
44 } | 46 } |
OLD | NEW |