OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 class NNative native "NNative" { | 8 @Native("NNative") |
| 9 class NNative { |
8 var status; | 10 var status; |
9 | 11 |
10 var f; | 12 var f; |
11 | 13 |
12 ClickCounter() { | 14 ClickCounter() { |
13 f = wrap(g); | 15 f = wrap(g); |
14 } | 16 } |
15 | 17 |
16 g(val) => "### $val ###"; | 18 g(val) => "### $val ###"; |
17 } | 19 } |
(...skipping 23 matching lines...) Expand all Loading... |
41 }; | 43 }; |
42 } | 44 } |
43 | 45 |
44 main() { | 46 main() { |
45 setup(); | 47 setup(); |
46 // Make sure the ClickCounter class goes through interceptors. | 48 // Make sure the ClickCounter class goes through interceptors. |
47 Expect.equals("### !!! 42 !!! ###", nativeId(new ClickCounter()).f(42)); | 49 Expect.equals("### !!! 42 !!! ###", nativeId(new ClickCounter()).f(42)); |
48 // We are interested in the direct call, where the type is known. | 50 // We are interested in the direct call, where the type is known. |
49 Expect.equals("### !!! 499 !!! ###", new ClickCounter().f(499)); | 51 Expect.equals("### !!! 499 !!! ###", new ClickCounter().f(499)); |
50 } | 52 } |
OLD | NEW |