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 // Test that native methods with unnamed optional arguments are called with the | 5 // Test that native methods with unnamed optional arguments are called with the |
6 // number of arguments in the call site AND the call site is inlined. | 6 // number of arguments in the call site AND the call site is inlined. |
7 | 7 |
8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
9 import 'dart:_js_helper' show NoInline; | 9 import 'dart:_js_helper' show Native, NoInline; |
10 | 10 |
11 typedef int Int2Int(int x); | 11 typedef int Int2Int(int x); |
12 | 12 |
13 class A native "A" { | 13 @Native("A") |
| 14 class A { |
14 int foo([x, y, z]) native; | 15 int foo([x, y, z]) native; |
15 | 16 |
16 // Calls can be inlined provided they don't pass an argument. | 17 // Calls can be inlined provided they don't pass an argument. |
17 int callFun([Int2Int fn]) native; | 18 int callFun([Int2Int fn]) native; |
18 } | 19 } |
19 | 20 |
20 class B { | 21 class B { |
21 static var g; | 22 static var g; |
22 @NoInline() | 23 @NoInline() |
23 method1(a) { | 24 method1(a) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 var b = new B(); | 144 var b = new B(); |
144 Expect.equals(2, b.method2()); | 145 Expect.equals(2, b.method2()); |
145 Expect.equals(246, b.method3()); | 146 Expect.equals(246, b.method3()); |
146 } | 147 } |
147 | 148 |
148 main() { | 149 main() { |
149 setup(); | 150 setup(); |
150 test1(); | 151 test1(); |
151 test2(); | 152 test2(); |
152 } | 153 } |
OLD | NEW |