OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 import "native_testing.dart"; | 5 import "native_testing.dart"; |
6 import 'dart:_js_helper' show setNativeSubclassDispatchRecord; | 6 import 'dart:_js_helper' show setNativeSubclassDispatchRecord; |
7 import 'dart:_interceptors' | 7 import 'dart:_interceptors' |
8 show findInterceptorForType, findConstructorForNativeSubclassType; | 8 show findInterceptorForType, findConstructorForNativeSubclassType; |
9 | 9 |
10 // Test for fields with same name as native fields. We expect N.foo to have the | 10 // Test for fields with same name as native fields. We expect N.foo to have the |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class B extends A { | 25 class B extends A { |
26 var foo = 333; | 26 var foo = 333; |
27 B.init() : super.init(); | 27 B.init() : super.init(); |
28 Afoo() => super.foo; | 28 Afoo() => super.foo; |
29 Bfoo() => foo; | 29 Bfoo() => foo; |
30 | 30 |
31 toString() => '[N.foo = ${Nfoo()}, A.foo = ${Afoo()}, B.foo = ${Bfoo()}]'; | 31 toString() => '[N.foo = ${Nfoo()}, A.foo = ${Afoo()}, B.foo = ${Bfoo()}]'; |
32 } | 32 } |
33 | 33 |
34 B makeB() native ; | 34 B makeB() native; |
35 | 35 |
36 @Creates('=Object') | 36 @Creates('=Object') |
37 getBPrototype() native ; | 37 getBPrototype() native; |
38 | 38 |
39 void setup() native r""" | 39 void setup() native r""" |
40 function B() { this.foo = 111; } // N.foo | 40 function B() { this.foo = 111; } // N.foo |
41 makeB = function(){return new B;}; | 41 makeB = function(){return new B;}; |
42 | 42 |
43 getBPrototype = function(){return B.prototype;}; | 43 getBPrototype = function(){return B.prototype;}; |
44 """; | 44 """; |
45 | 45 |
46 main() { | 46 main() { |
47 nativeTesting(); | 47 nativeTesting(); |
(...skipping 10 matching lines...) Expand all Loading... |
58 print(b); | 58 print(b); |
59 | 59 |
60 Expect.equals(333, confuse(b).Bfoo()); | 60 Expect.equals(333, confuse(b).Bfoo()); |
61 Expect.equals(222, confuse(b).Afoo()); | 61 Expect.equals(222, confuse(b).Afoo()); |
62 Expect.equals(111, confuse(b).Nfoo()); | 62 Expect.equals(111, confuse(b).Nfoo()); |
63 | 63 |
64 Expect.equals(333, b.Bfoo()); | 64 Expect.equals(333, b.Bfoo()); |
65 Expect.equals(222, b.Afoo()); | 65 Expect.equals(222, b.Afoo()); |
66 Expect.equals(111, b.Nfoo()); | 66 Expect.equals(111, b.Nfoo()); |
67 } | 67 } |
OLD | NEW |