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

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

Issue 2700053003: Don't use magic strings/properties to communicate between compiler and runtime. (Closed)
Patch Set: Small cleanup. Created 3 years, 10 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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 } 620 }
621 621
622 js.Expression _generateConstructor(Class cls) { 622 js.Expression _generateConstructor(Class cls) {
623 List<js.Name> fieldNames = const <js.Name>[]; 623 List<js.Name> fieldNames = const <js.Name>[];
624 624
625 // If the class is not directly instantiated we only need it for inheritance 625 // If the class is not directly instantiated we only need it for inheritance
626 // or RTI. In either case we don't need its fields. 626 // or RTI. In either case we don't need its fields.
627 if (cls.isDirectlyInstantiated && !cls.isNative) { 627 if (cls.isDirectlyInstantiated && !cls.isNative) {
628 fieldNames = cls.fields.map((Field field) => field.name).toList(); 628 fieldNames = cls.fields.map((Field field) => field.name).toList();
629 if (cls.hasRtiField) { 629 if (cls.hasRtiField) {
630 fieldNames.add(namer.rtiFieldName); 630 fieldNames.add(namer.rtiFieldJsName);
631 } 631 }
632 } 632 }
633 js.Name name = cls.name; 633 js.Name name = cls.name;
634 634
635 Iterable<js.Name> assignments = fieldNames.map((js.Name field) { 635 Iterable<js.Name> assignments = fieldNames.map((js.Name field) {
636 return js.js("this.#field = #field", {"field": field}); 636 return js.js("this.#field = #field", {"field": field});
637 }); 637 });
638 638
639 return js.js('function #(#) { # }', [name, fieldNames, assignments]); 639 return js.js('function #(#) { # }', [name, fieldNames, assignments]);
640 } 640 }
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 #eagerClasses; 1270 #eagerClasses;
1271 1271
1272 var end = Date.now(); 1272 var end = Date.now();
1273 // print('Setup: ' + (end - start) + ' ms.'); 1273 // print('Setup: ' + (end - start) + ' ms.');
1274 1274
1275 #invokeMain; // Start main. 1275 #invokeMain; // Start main.
1276 1276
1277 })(Date.now(), #code) 1277 })(Date.now(), #code)
1278 }"""; 1278 }""";
1279 } 1279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698