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

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: 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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 628 if (cls.hasRtiField) {
629 fieldNames.add(namer.rtiFieldName); 629 fieldNames.add(namer.rtiFieldJsName);
630 } 630 }
631 } 631 }
632 js.Name name = cls.name; 632 js.Name name = cls.name;
633 633
634 Iterable<js.Name> assignments = fieldNames.map((js.Name field) { 634 Iterable<js.Name> assignments = fieldNames.map((js.Name field) {
635 return js.js("this.#field = #field", {"field": field}); 635 return js.js("this.#field = #field", {"field": field});
636 }); 636 });
637 637
638 return js.js('function #(#) { # }', [name, fieldNames, assignments]); 638 return js.js('function #(#) { # }', [name, fieldNames, assignments]);
639 } 639 }
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 #eagerClasses; 1269 #eagerClasses;
1270 1270
1271 var end = Date.now(); 1271 var end = Date.now();
1272 // print('Setup: ' + (end - start) + ' ms.'); 1272 // print('Setup: ' + (end - start) + ' ms.');
1273 1273
1274 #invokeMain; // Start main. 1274 #invokeMain; // Start main.
1275 1275
1276 })(Date.now(), #code) 1276 })(Date.now(), #code)
1277 }"""; 1277 }""";
1278 } 1278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698