| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, 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 to see if a Dart class name is confused with dispatch tag. Both class A |
| 6 // and class Z have a JavaScript constuctor named "A". The dynamic native class |
| 7 // dispatch hook on Object.prototype should avoid patching the Dart class A. |
| 8 // This could be done by renaming the Dart constructor or by being able to check |
| 9 // that objects are Dart classes. |
| 10 |
| 11 class A { |
| 12 } |
| 13 |
| 14 class Z native "*A" { |
| 15 foo() => 100; |
| 16 } |
| 17 |
| 18 makeZ() native; |
| 19 |
| 20 void setup() native """ |
| 21 function A(){} |
| 22 makeZ = function(){return new A}; |
| 23 """; |
| 24 |
| 25 main() { |
| 26 setup(); |
| 27 |
| 28 var a = new A(); |
| 29 var z = makeZ(); |
| 30 |
| 31 Expect.equals(100, z.foo()); |
| 32 |
| 33 Expect.throws(() => a.foo(), (ex) => ex is NoSuchMethodError); |
| 34 } |
| OLD | NEW |