| 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 // Test for correct hidden native class when abstract class has same name. | 5 // Test for correct hidden native class when abstract class has same name. |
| 6 | 6 |
| 7 library main; | 7 library main; |
| 8 | 8 |
| 9 import 'native_testing.dart'; | 9 import 'native_testing.dart'; |
| 10 import 'native_library_same_name_used_lib1.dart'; | 10 import 'native_library_same_name_used_lib1.dart'; |
| 11 | 11 |
| 12 void setup() native """ | 12 void setup() { |
| 13 JS('', r""" |
| 14 (function(){ |
| 13 // This code is all inside 'setup' and so not accessible from the global | 15 // This code is all inside 'setup' and so not accessible from the global |
| 14 // scope. | 16 // scope. |
| 15 function I(){} | 17 function I(){} |
| 16 I.prototype.read = function() { return this._x; }; | 18 I.prototype.read = function() { return this._x; }; |
| 17 I.prototype.write = function(x) { this._x = x; }; | 19 I.prototype.write = function(x) { this._x = x; }; |
| 18 makeI = function(){return new I}; | 20 makeI = function(){return new I()}; |
| 19 self.nativeConstructor(I); | 21 self.nativeConstructor(I); |
| 20 """; | 22 })()"""); |
| 23 } |
| 21 | 24 |
| 22 // A pure Dart implementation of I. | 25 // A pure Dart implementation of I. |
| 23 | 26 |
| 24 class ProxyI implements I { | 27 class ProxyI implements I { |
| 25 ProxyI b; | 28 ProxyI b; |
| 26 ProxyI read() { | 29 ProxyI read() { |
| 27 return b; | 30 return b; |
| 28 } | 31 } |
| 29 | 32 |
| 30 write(ProxyI x) { | 33 write(ProxyI x) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 47 | 50 |
| 48 Expect.isTrue(b1 is I, 'b1 is I'); | 51 Expect.isTrue(b1 is I, 'b1 is I'); |
| 49 Expect.isTrue(b1 is ProxyI, 'b1 is ProxyI'); | 52 Expect.isTrue(b1 is ProxyI, 'b1 is ProxyI'); |
| 50 | 53 |
| 51 Expect.isTrue(a1 is I, 'a1 is I'); | 54 Expect.isTrue(a1 is I, 'a1 is I'); |
| 52 Expect.isFalse(a1 is ProxyI, 'a1 is ProxyI'); | 55 Expect.isFalse(a1 is ProxyI, 'a1 is ProxyI'); |
| 53 | 56 |
| 54 Expect.isTrue(confuse(a1) is I, 'a1 is I'); | 57 Expect.isTrue(confuse(a1) is I, 'a1 is I'); |
| 55 Expect.isFalse(confuse(a1) is ProxyI, 'a1 is ProxyI'); | 58 Expect.isFalse(confuse(a1) is ProxyI, 'a1 is ProxyI'); |
| 56 } | 59 } |
| OLD | NEW |