OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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:mirrors" show reflect; | 5 import "dart:mirrors" show reflect; |
6 import "dart:_js_helper"; | 6 import "dart:_js_helper"; |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 class GetName { | 9 class GetName { |
10 foo(x, [y]) => "foo"; | 10 foo(x, [y]) => "foo"; |
(...skipping 11 matching lines...) Expand all Loading... |
22 @Native("B") | 22 @Native("B") |
23 class B { | 23 class B { |
24 baz() => 42; | 24 baz() => 42; |
25 } | 25 } |
26 | 26 |
27 class C { | 27 class C { |
28 static create() => new C(); | 28 static create() => new C(); |
29 noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}"; | 29 noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}"; |
30 } | 30 } |
31 | 31 |
32 makeA() native; | 32 makeA() native ; |
33 | 33 |
34 setup() native """ | 34 setup() native """ |
35 function A() {} | 35 function A() {} |
36 makeA = function() { return new A; } | 36 makeA = function() { return new A; } |
37 """; | 37 """; |
38 | 38 |
39 main() { | 39 main() { |
40 setup(); | 40 setup(); |
41 var a = makeA(); | 41 var a = makeA(); |
42 a.bar(); | 42 a.bar(); |
43 Expect.equals("native(foo:[1, 2])", a.foo(1, 2)); | 43 Expect.equals("native(foo:[1, 2])", a.foo(1, 2)); |
44 Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5)); | 44 Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5)); |
45 var c = C.create(); | 45 var c = C.create(); |
46 Expect.equals("foo:[6]", c.foo(6)); | 46 Expect.equals("foo:[6]", c.foo(6)); |
47 } | 47 } |
OLD | NEW |