| 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 'native_metadata.dart'; |
| 6 |
| 5 typedef void MyFunctionType(); | 7 typedef void MyFunctionType(); |
| 6 | 8 |
| 7 @native("*A") | 9 @Native("*A") |
| 8 class A { | 10 class A { |
| 9 @native setClosure(MyFunctionType f); | 11 @native setClosure(MyFunctionType f); |
| 10 @native check(MyFunctionType f); | 12 @native check(MyFunctionType f); |
| 11 @native invoke(); | 13 @native invoke(); |
| 12 } | 14 } |
| 13 | 15 |
| 14 @native makeA() { return new A(); } | 16 @native makeA() { return new A(); } |
| 15 | 17 |
| 16 @native(""" | 18 @Native(""" |
| 17 function A() {} | 19 function A() {} |
| 18 A.prototype.setClosure = function(f) { this.f = f; }; | 20 A.prototype.setClosure = function(f) { this.f = f; }; |
| 19 A.prototype.check = function(f) { return this.f === f; }; | 21 A.prototype.check = function(f) { return this.f === f; }; |
| 20 A.prototype.invoke = function() { return this.f(); }; | 22 A.prototype.invoke = function() { return this.f(); }; |
| 21 makeA = function(){return new A;}; | 23 makeA = function(){return new A;}; |
| 22 """) | 24 """) |
| 23 void setup(); | 25 void setup(); |
| 24 | 26 |
| 25 var staticClosure; | 27 var staticClosure; |
| 26 staticMethod() => 42; | 28 staticMethod() => 42; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 65 |
| 64 checkUntyped(makeA(), b.instanceMethod); | 66 checkUntyped(makeA(), b.instanceMethod); |
| 65 checkTyped(makeA(), b.instanceMethod); | 67 checkTyped(makeA(), b.instanceMethod); |
| 66 | 68 |
| 67 checkUntyped(makeA(), closureStatement); | 69 checkUntyped(makeA(), closureStatement); |
| 68 checkTyped(makeA(), closureStatement); | 70 checkTyped(makeA(), closureStatement); |
| 69 | 71 |
| 70 checkUntyped(makeA(), closureExpression); | 72 checkUntyped(makeA(), closureExpression); |
| 71 checkTyped(makeA(), closureExpression); | 73 checkTyped(makeA(), closureExpression); |
| 72 } | 74 } |
| OLD | NEW |