| 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:_foreign_helper' show JS; | 6 import 'dart:_foreign_helper' show JS; |
| 7 import 'dart:_js_helper' show Creates, setNativeSubclassDispatchRecord; | 7 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord; |
| 8 import 'dart:_interceptors' show | 8 import 'dart:_interceptors' show |
| 9 findInterceptorForType, findConstructorForNativeSubclassType; | 9 findInterceptorForType, findConstructorForNativeSubclassType; |
| 10 | 10 |
| 11 // Test that subclasses of native classes can be initialized by calling the | 11 // Test that subclasses of native classes can be initialized by calling the |
| 12 // 'upgrade' constructor. | 12 // 'upgrade' constructor. |
| 13 | 13 |
| 14 var trace = []; | 14 var trace = []; |
| 15 | 15 |
| 16 var log; | 16 var log; |
| 17 | 17 |
| 18 class A native "A" { | 18 @Native("A") |
| 19 class A { |
| 19 final a1 = log(101); // Only initialized IF named constructor called. | 20 final a1 = log(101); // Only initialized IF named constructor called. |
| 20 final a2; // Initialized by native constructor. | 21 final a2; // Initialized by native constructor. |
| 21 final a3; // Initialized only by A.two. | 22 final a3; // Initialized only by A.two. |
| 22 var a4 = log(104); | 23 var a4 = log(104); |
| 23 | 24 |
| 24 A.one(); | 25 A.one(); |
| 25 | 26 |
| 26 A.two() : a3 = log(103) { | 27 A.two() : a3 = log(103) { |
| 27 log('body(A.two)'); | 28 log('body(A.two)'); |
| 28 log(a4 += increment); | 29 log(a4 += increment); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return message; | 168 return message; |
| 168 }; | 169 }; |
| 169 | 170 |
| 170 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); | 171 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); |
| 171 | 172 |
| 172 test_one(); | 173 test_one(); |
| 173 test_two(); | 174 test_two(); |
| 174 test_three(); | 175 test_three(); |
| 175 test_new(); | 176 test_new(); |
| 176 } | 177 } |
| OLD | NEW |