| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // A native method prevents other members from having that name, including | 5 // A native method prevents other members from having that name, including |
| 6 // fields. However, native fields keep their name. The implication: a getter | 6 // fields. However, native fields keep their name. The implication: a getter |
| 7 // for the field must be based on the field's name, not the field's jsname. | 7 // for the field must be based on the field's name, not the field's jsname. |
| 8 | 8 |
| 9 import 'native_testing.dart'; | 9 import 'native_testing.dart'; |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 int native_key_method() native; | 30 int native_key_method() native; |
| 31 // This should cause B.key to be renamed, but not A.key. | 31 // This should cause B.key to be renamed, but not A.key. |
| 32 @JSName('key') | 32 @JSName('key') |
| 33 int key() native; | 33 int key() native; |
| 34 } | 34 } |
| 35 | 35 |
| 36 A makeA() native; | 36 A makeA() native; |
| 37 X makeX() native; | 37 X makeX() native; |
| 38 | 38 |
| 39 void setup() native """ | 39 void setup() native """ |
| 40 // This code is all inside 'setup' and so not accesible from the global scope. | 40 // This code is all inside 'setup' and so not accessible from the global scope. |
| 41 function A(){ this.key = 111; } | 41 function A(){ this.key = 111; } |
| 42 A.prototype.getKey = function(){return this.key;}; | 42 A.prototype.getKey = function(){return this.key;}; |
| 43 | 43 |
| 44 function X(){} | 44 function X(){} |
| 45 X.prototype.key = function(){return 666;}; | 45 X.prototype.key = function(){return 666;}; |
| 46 | 46 |
| 47 makeA = function(){return new A}; | 47 makeA = function(){return new A}; |
| 48 makeX = function(){return new X}; | 48 makeX = function(){return new X}; |
| 49 | 49 |
| 50 self.nativeConstructor(A); | 50 self.nativeConstructor(A); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 main() { | 94 main() { |
| 95 nativeTesting(); | 95 nativeTesting(); |
| 96 setup(); | 96 setup(); |
| 97 | 97 |
| 98 testTyped(); | 98 testTyped(); |
| 99 testPartial(); | 99 testPartial(); |
| 100 testDynamic(); | 100 testDynamic(); |
| 101 } | 101 } |
| OLD | NEW |