| 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 class GetName { |
| 6 foo(x, y, [z]) => "foo"; |
| 7 } |
| 8 |
| 9 static String getName(im) => im.invokeOn(new GetName()); |
| 10 |
| 5 class A native "*A" { | 11 class A native "*A" { |
| 6 bar() => 42; | 12 bar() => 42; |
| 7 } | 13 } |
| 8 | 14 |
| 9 class B native "*B" { | 15 class B native "*B" { |
| 10 foo() => 42; | 16 foo() => 42; |
| 11 } | 17 } |
| 12 | 18 |
| 13 class C { | 19 class C { |
| 14 static create() => new C(); | 20 static create() => new C(); |
| 15 noSuchMethod(x) => "${x.memberName}:${x.positionalArguments}"; | 21 noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}"; |
| 16 } | 22 } |
| 17 | 23 |
| 18 makeA() native; | 24 makeA() native; |
| 19 | 25 |
| 20 setup() native """ | 26 setup() native """ |
| 21 function A() {} | 27 function A() {} |
| 22 makeA = function() { return new A; } | 28 makeA = function() { return new A; } |
| 23 """; | 29 """; |
| 24 | 30 |
| 25 main() { | 31 main() { |
| 26 setup(); | 32 setup(); |
| 27 var a = makeA(); | 33 var a = makeA(); |
| 28 a.bar(); | 34 a.bar(); |
| 29 var exception; | 35 var exception; |
| 30 try { | 36 try { |
| 31 a.foo(); | 37 a.foo(); |
| 32 } on NoSuchMethodError catch (e) { | 38 } on NoSuchMethodError catch (e) { |
| 33 exception = e; | 39 exception = e; |
| 34 } | 40 } |
| 35 Expect.isNotNull(exception); | 41 Expect.isNotNull(exception); |
| 36 var c = C.create(); | 42 var c = C.create(); |
| 37 Expect.equals("foo:[1, 2]", c.foo(1, 2)); | 43 Expect.equals("foo:[1, 2]", c.foo(1, 2)); |
| 38 Expect.equals("foo:[3, 4, 5]", c.foo(3, 4, 5)); | 44 Expect.equals("foo:[3, 4, 5]", c.foo(3, 4, 5)); |
| 39 } | 45 } |
| OLD | NEW |