| 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 "native_testing.dart"; | 6 import "native_testing.dart"; |
| 7 | 7 |
| 8 class GetName { | 8 class GetName { |
| 9 foo(x, [y]) => "foo"; | 9 foo(x, [y]) => "foo"; |
| 10 baz(x, y, z) => "baz"; | 10 baz(x, y, z) => "baz"; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 @Native("B") | 21 @Native("B") |
| 22 class B { | 22 class B { |
| 23 baz() => 42; | 23 baz() => 42; |
| 24 } | 24 } |
| 25 | 25 |
| 26 class C { | 26 class C { |
| 27 static create() => new C(); | 27 static create() => new C(); |
| 28 noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}"; | 28 noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}"; |
| 29 } | 29 } |
| 30 | 30 |
| 31 makeA() native ; | 31 makeA() native; |
| 32 | 32 |
| 33 setup() native """ | 33 setup() native """ |
| 34 function A() {} | 34 function A() {} |
| 35 makeA = function() { return new A; } | 35 makeA = function() { return new A; } |
| 36 self.nativeConstructor(A); | 36 self.nativeConstructor(A); |
| 37 """; | 37 """; |
| 38 | 38 |
| 39 main() { | 39 main() { |
| 40 nativeTesting(); | 40 nativeTesting(); |
| 41 setup(); | 41 setup(); |
| 42 var a = makeA(); | 42 var a = makeA(); |
| 43 a.bar(); | 43 a.bar(); |
| 44 Expect.equals("native(foo:[1, 2])", a.foo(1, 2)); | 44 Expect.equals("native(foo:[1, 2])", a.foo(1, 2)); |
| 45 Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5)); | 45 Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5)); |
| 46 var c = C.create(); | 46 var c = C.create(); |
| 47 Expect.equals("foo:[6]", c.foo(6)); | 47 Expect.equals("foo:[6]", c.foo(6)); |
| 48 } | 48 } |
| OLD | NEW |