| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Test for correct hidden native class when interface has same name. |
| 6 |
| 7 #import('NativeLibrarySameNameUsedLib1.dart'); |
| 8 |
| 9 void setup() native """ |
| 10 // This code is all inside 'setup' and so not accesible from the global scope. |
| 11 function I(){} |
| 12 I.prototype.read = function() { return this._x; }; |
| 13 I.prototype.write = function(x) { this._x = x; }; |
| 14 makeI = function(){return new I}; |
| 15 """; |
| 16 |
| 17 // A pure Dart implementation of I. |
| 18 |
| 19 class ProxyI implements I { |
| 20 ProxyI b; |
| 21 ProxyI read() { return b; } |
| 22 write(ProxyI x) { b = x; } |
| 23 } |
| 24 |
| 25 main() { |
| 26 setup(); |
| 27 |
| 28 var a1 = makeI(); |
| 29 var a2 = makeI(); |
| 30 var b1 = new ProxyI(); |
| 31 var b2 = new ProxyI(); |
| 32 var ob = new Object(); |
| 33 |
| 34 Expect.isFalse(ob is I, 'ob is I'); |
| 35 Expect.isFalse(ob is ProxyI, 'ob is ProxyI'); |
| 36 |
| 37 Expect.isTrue(b1 is I, 'b1 is I'); |
| 38 Expect.isTrue(b1 is ProxyI, 'b1 is ProxyI'); |
| 39 |
| 40 Expect.isTrue(a1 is I, 'a1 is I'); |
| 41 Expect.isFalse(a1 is ProxyI, 'a1 is ProxyI'); |
| 42 } |
| OLD | NEW |