| 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 return new js.ArrayInitializer([staticArray, classArray]); | 617 return new js.ArrayInitializer([staticArray, classArray]); |
| 618 } | 618 } |
| 619 | 619 |
| 620 js.Expression _generateConstructor(Class cls) { | 620 js.Expression _generateConstructor(Class cls) { |
| 621 List<js.Name> fieldNames = const <js.Name>[]; | 621 List<js.Name> fieldNames = const <js.Name>[]; |
| 622 | 622 |
| 623 // If the class is not directly instantiated we only need it for inheritance | 623 // If the class is not directly instantiated we only need it for inheritance |
| 624 // or RTI. In either case we don't need its fields. | 624 // or RTI. In either case we don't need its fields. |
| 625 if (cls.isDirectlyInstantiated && !cls.isNative) { | 625 if (cls.isDirectlyInstantiated && !cls.isNative) { |
| 626 fieldNames = cls.fields.map((Field field) => field.name).toList(); | 626 fieldNames = cls.fields.map((Field field) => field.name).toList(); |
| 627 if (cls.hasRti) { |
| 628 fieldNames.add(namer.rtiFieldName); |
| 629 } |
| 627 } | 630 } |
| 628 js.Name name = cls.name; | 631 js.Name name = cls.name; |
| 629 | 632 |
| 630 Iterable<js.Name> assignments = fieldNames.map((js.Name field) { | 633 Iterable<js.Name> assignments = fieldNames.map((js.Name field) { |
| 631 return js.js("this.#field = #field", {"field": field}); | 634 return js.js("this.#field = #field", {"field": field}); |
| 632 }); | 635 }); |
| 633 | 636 |
| 634 return js.js('function #(#) { # }', [name, fieldNames, assignments]); | 637 return js.js('function #(#) { # }', [name, fieldNames, assignments]); |
| 635 } | 638 } |
| 636 | 639 |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 #eagerClasses; | 1265 #eagerClasses; |
| 1263 | 1266 |
| 1264 var end = Date.now(); | 1267 var end = Date.now(); |
| 1265 // print('Setup: ' + (end - start) + ' ms.'); | 1268 // print('Setup: ' + (end - start) + ' ms.'); |
| 1266 | 1269 |
| 1267 #invokeMain; // Start main. | 1270 #invokeMain; // Start main. |
| 1268 | 1271 |
| 1269 })(Date.now(), #code) | 1272 })(Date.now(), #code) |
| 1270 }"""; | 1273 }"""; |
| 1271 } | 1274 } |
| OLD | NEW |