Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart

Issue 2310573002: dart2js: Pass type information to constructor rather than add later. (Closed)
Patch Set: Filter out type info pseudofield when parsing fieldspec for mirrors Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698