OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.js_emitter.lazy_emitter.model_emitter; | 5 library dart2js.js_emitter.lazy_emitter.model_emitter; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart' | 7 import 'package:js_runtime/shared/embedded_names.dart' |
8 show | 8 show |
9 CREATE_NEW_ISOLATE, | 9 CREATE_NEW_ISOLATE, |
10 DEFERRED_LIBRARY_URIS, | 10 DEFERRED_LIBRARY_URIS, |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 return new js.ArrayInitializer([staticArray, classArray]); | 618 return new js.ArrayInitializer([staticArray, classArray]); |
619 } | 619 } |
620 | 620 |
621 js.Expression _generateConstructor(Class cls) { | 621 js.Expression _generateConstructor(Class cls) { |
622 List<js.Name> fieldNames = const <js.Name>[]; | 622 List<js.Name> fieldNames = const <js.Name>[]; |
623 | 623 |
624 // If the class is not directly instantiated we only need it for inheritance | 624 // If the class is not directly instantiated we only need it for inheritance |
625 // or RTI. In either case we don't need its fields. | 625 // or RTI. In either case we don't need its fields. |
626 if (cls.isDirectlyInstantiated && !cls.isNative) { | 626 if (cls.isDirectlyInstantiated && !cls.isNative) { |
627 fieldNames = cls.fields.map((Field field) => field.name).toList(); | 627 fieldNames = cls.fields.map((Field field) => field.name).toList(); |
| 628 if (cls.hasRtiField) { |
| 629 fieldNames.add(namer.rtiFieldName); |
| 630 } |
628 } | 631 } |
629 js.Name name = cls.name; | 632 js.Name name = cls.name; |
630 | 633 |
631 Iterable<js.Name> assignments = fieldNames.map((js.Name field) { | 634 Iterable<js.Name> assignments = fieldNames.map((js.Name field) { |
632 return js.js("this.#field = #field", {"field": field}); | 635 return js.js("this.#field = #field", {"field": field}); |
633 }); | 636 }); |
634 | 637 |
635 return js.js('function #(#) { # }', [name, fieldNames, assignments]); | 638 return js.js('function #(#) { # }', [name, fieldNames, assignments]); |
636 } | 639 } |
637 | 640 |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 #eagerClasses; | 1267 #eagerClasses; |
1265 | 1268 |
1266 var end = Date.now(); | 1269 var end = Date.now(); |
1267 // print('Setup: ' + (end - start) + ' ms.'); | 1270 // print('Setup: ' + (end - start) + ' ms.'); |
1268 | 1271 |
1269 #invokeMain; // Start main. | 1272 #invokeMain; // Start main. |
1270 | 1273 |
1271 })(Date.now(), #code) | 1274 })(Date.now(), #code) |
1272 }"""; | 1275 }"""; |
1273 } | 1276 } |
OLD | NEW |