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

Side by Side Diff: lib/compiler/implementation/js_backend/emitter.dart

Issue 10905305: Patch refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 } 632 }
633 } 633 }
634 634
635 // If a class is not instantiated then we add the field just so we can 635 // If a class is not instantiated then we add the field just so we can
636 // generate the field getter/setter dynamically. Since this is only 636 // generate the field getter/setter dynamically. Since this is only
637 // allowed on fields that are in [classElement] we don't need to visit 637 // allowed on fields that are in [classElement] we don't need to visit
638 // superclasses for non-instantiated classes. 638 // superclasses for non-instantiated classes.
639 classElement.forEachInstanceField( 639 classElement.forEachInstanceField(
640 addField, 640 addField,
641 includeBackendMembers: true, 641 includeBackendMembers: true,
642 includeSuperMembers: isInstantiated && !classElement.isNative()); 642 includeSuperMembers: isInstantiated && !classElement.isNative(),
643 includeInjectedMembers: true);
643 return checkedSetters; 644 return checkedSetters;
644 } 645 }
645 646
646 /** 647 /**
647 * Documentation wanted -- johnniwinther 648 * Documentation wanted -- johnniwinther
648 * 649 *
649 * Invariant: [classElement] must be a declaration element. 650 * Invariant: [classElement] must be a declaration element.
650 */ 651 */
651 void emitInstanceMembers(ClassElement classElement, 652 void emitInstanceMembers(ClassElement classElement,
652 CodeBuffer buffer, 653 CodeBuffer buffer,
653 bool needsLeadingComma) { 654 bool needsLeadingComma) {
654 assert(invariant(classElement, classElement.isDeclaration)); 655 assert(invariant(classElement, classElement.isDeclaration));
655 bool needsComma = needsLeadingComma; 656 bool needsComma = needsLeadingComma;
656 void defineInstanceMember(String name, CodeBuffer memberBuffer) { 657 void defineInstanceMember(String name, CodeBuffer memberBuffer) {
657 if (needsComma) buffer.add(','); 658 if (needsComma) buffer.add(',');
658 needsComma = true; 659 needsComma = true;
659 buffer.add('\n'); 660 buffer.add('\n');
660 buffer.add(' $name: '); 661 buffer.add(' $name: ');
661 buffer.add(memberBuffer); 662 buffer.add(memberBuffer);
662 } 663 }
663 664
664 classElement.forEachMember(includeBackendMembers: true, 665 classElement.forEachMember(includeBackendMembers: true,
666 includeInjectedMembers: true,
665 f: (ClassElement enclosing, Element member) { 667 f: (ClassElement enclosing, Element member) {
666 assert(invariant(classElement, member.isDeclaration)); 668 assert(invariant(classElement, member.isDeclaration));
667 if (member.isInstanceMember()) { 669 if (member.isInstanceMember()) {
668 addInstanceMember(member, defineInstanceMember); 670 addInstanceMember(member, defineInstanceMember);
669 } 671 }
670 }); 672 });
671 673
672 generateIsTestsOn(classElement, (Element other) { 674 generateIsTestsOn(classElement, (Element other) {
673 String code; 675 String code;
674 if (nativeEmitter.requiresNativeIsCheck(other)) { 676 if (nativeEmitter.requiresNativeIsCheck(other)) {
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 const String HOOKS_API_USAGE = """ 1436 const String HOOKS_API_USAGE = """
1435 // Generated by dart2js, the Dart to JavaScript compiler. 1437 // Generated by dart2js, the Dart to JavaScript compiler.
1436 // The code supports the following hooks: 1438 // The code supports the following hooks:
1437 // dartPrint(message) - if this function is defined it is called 1439 // dartPrint(message) - if this function is defined it is called
1438 // instead of the Dart [print] method. 1440 // instead of the Dart [print] method.
1439 // dartMainRunner(main) - if this function is defined, the Dart [main] 1441 // dartMainRunner(main) - if this function is defined, the Dart [main]
1440 // method will not be invoked directly. 1442 // method will not be invoked directly.
1441 // Instead, a closure that will invoke [main] is 1443 // Instead, a closure that will invoke [main] is
1442 // passed to [dartMainRunner]. 1444 // passed to [dartMainRunner].
1443 """; 1445 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698