| 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 A native "*A" { | 5 @native("*A") |
| 6 class A { |
| 6 } | 7 } |
| 7 | 8 |
| 8 makeA() native; | 9 @native makeA(); |
| 9 | 10 |
| 10 void setup() native """ | 11 @native(""" |
| 11 function A() {}; | 12 function A() {}; |
| 12 A.prototype.foo = function() { return 42; } | 13 A.prototype.foo = function() { return 42; } |
| 13 makeA = function() { return new A; } | 14 makeA = function() { return new A; } |
| 14 """; | 15 """) |
| 16 void setup(); |
| 15 | 17 |
| 16 class B { | 18 class B { |
| 17 // We need to define a foo method so that Frog sees it. Because it's | 19 // We need to define a foo method so that Frog sees it. Because it's |
| 18 // the only occurence of 'foo', Frog does not bother mangling the | 20 // the only occurence of 'foo', Frog does not bother mangling the |
| 19 // call sites. It thinks all calls will either go to this method, or | 21 // call sites. It thinks all calls will either go to this method, or |
| 20 // throw a NoSuchMethodException. | 22 // throw a NoSuchMethodException. |
| 21 foo() { return 42; } | 23 foo() { return 42; } |
| 22 } | 24 } |
| 23 | 25 |
| 24 typedContext() { | 26 typedContext() { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 41 (e) => e is NoSuchMethodException); | 43 (e) => e is NoSuchMethodException); |
| 42 Expect.throws(() => a.foo = 4, | 44 Expect.throws(() => a.foo = 4, |
| 43 (e) => e is NoSuchMethodException); | 45 (e) => e is NoSuchMethodException); |
| 44 } | 46 } |
| 45 | 47 |
| 46 main() { | 48 main() { |
| 47 setup(); | 49 setup(); |
| 48 typedContext(); | 50 typedContext(); |
| 49 untypedContext(); | 51 untypedContext(); |
| 50 } | 52 } |
| OLD | NEW |