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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart

Issue 2647893002: Use entities in js_emitter/model.dart (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 part of dart2js.js_emitter.startup_emitter.model_emitter; 5 part of dart2js.js_emitter.startup_emitter.model_emitter;
6 6
7 /// The name of the property that stores the tear-off getter on a static 7 /// The name of the property that stores the tear-off getter on a static
8 /// function. 8 /// function.
9 /// 9 ///
10 /// This property is only used when isolates are used. 10 /// This property is only used when isolates are used.
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 /// Emits the prototype-section of the fragment. 674 /// Emits the prototype-section of the fragment.
675 /// 675 ///
676 /// This section updates the prototype-property of all constructors in the 676 /// This section updates the prototype-property of all constructors in the
677 /// global holders. 677 /// global holders.
678 js.Statement emitPrototypes(Fragment fragment) { 678 js.Statement emitPrototypes(Fragment fragment) {
679 List<js.Statement> assignments = fragment.libraries 679 List<js.Statement> assignments = fragment.libraries
680 .expand((Library library) => library.classes) 680 .expand((Library library) => library.classes)
681 .map((Class cls) { 681 .map((Class cls) {
682 var proto = js.js.statement( 682 var proto = js.js.statement(
683 '#.prototype = #;', [classReference(cls), emitPrototype(cls)]); 683 '#.prototype = #;', [classReference(cls), emitPrototype(cls)]);
684 compiler.dumpInfoTask.registerElementAst(cls.element, proto); 684 ClassElement element = cls.element;
685 compiler.dumpInfoTask.registerElementAst(cls.element.library, proto); 685 compiler.dumpInfoTask.registerElementAst(element, proto);
686 compiler.dumpInfoTask.registerElementAst(element.library, proto);
686 return proto; 687 return proto;
687 }).toList(growable: false); 688 }).toList(growable: false);
688 689
689 return new js.Block(assignments); 690 return new js.Block(assignments);
690 } 691 }
691 692
692 /// Emits the prototype of the given class [cls]. 693 /// Emits the prototype of the given class [cls].
693 /// 694 ///
694 /// The prototype is generated as object literal. Inheritance is ignored. 695 /// The prototype is generated as object literal. Inheritance is ignored.
695 /// 696 ///
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 callNames.add(stubMethod.callName); 958 callNames.add(stubMethod.callName);
958 addFunOrName(stubMethod); 959 addFunOrName(stubMethod);
959 } 960 }
960 961
961 js.ArrayInitializer callNameArray = 962 js.ArrayInitializer callNameArray =
962 new js.ArrayInitializer(callNames.map(js.quoteName).toList()); 963 new js.ArrayInitializer(callNames.map(js.quoteName).toList());
963 js.ArrayInitializer funsOrNamesArray = new js.ArrayInitializer(funsOrNames); 964 js.ArrayInitializer funsOrNamesArray = new js.ArrayInitializer(funsOrNames);
964 965
965 bool isIntercepted = false; 966 bool isIntercepted = false;
966 if (method is InstanceMethod) { 967 if (method is InstanceMethod) {
967 isIntercepted = backend.isInterceptedMethod(method.element); 968 MethodElement element = method.element;
969 isIntercepted = backend.isInterceptedMethod(element);
968 } 970 }
969 int requiredParameterCount = 0; 971 int requiredParameterCount = 0;
970 js.Expression optionalParameterDefaultValues = new js.LiteralNull(); 972 js.Expression optionalParameterDefaultValues = new js.LiteralNull();
971 if (method.canBeApplied) { 973 if (method.canBeApplied) {
972 requiredParameterCount = method.requiredParameterCount; 974 requiredParameterCount = method.requiredParameterCount;
973 optionalParameterDefaultValues = 975 optionalParameterDefaultValues =
974 _encodeOptionalParameterDefaultValues(method); 976 _encodeOptionalParameterDefaultValues(method);
975 } 977 }
976 978
977 return js.js.statement( 979 return js.js.statement(
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 } 1385 }
1384 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", 1386 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);",
1385 js.objectLiteral(interceptorsByTag))); 1387 js.objectLiteral(interceptorsByTag)));
1386 statements.add( 1388 statements.add(
1387 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags))); 1389 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags)));
1388 statements.addAll(subclassAssignments); 1390 statements.addAll(subclassAssignments);
1389 1391
1390 return new js.Block(statements); 1392 return new js.Block(statements);
1391 } 1393 }
1392 } 1394 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698