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

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, 2 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 } 630 }
631 } 631 }
632 buffer.add('"'); 632 buffer.add('"');
633 } 633 }
634 } 634 }
635 635
636 // If a class is not instantiated then we add the field just so we can 636 // If a class is not instantiated then we add the field just so we can
637 // generate the field getter/setter dynamically. Since this is only 637 // generate the field getter/setter dynamically. Since this is only
638 // allowed on fields that are in [classElement] we don't need to visit 638 // allowed on fields that are in [classElement] we don't need to visit
639 // superclasses for non-instantiated classes. 639 // superclasses for non-instantiated classes.
640 classElement.forEachInstanceField( 640 classElement.implementation.forEachInstanceField(
641 addField, 641 addField,
642 includeBackendMembers: true, 642 includeBackendMembers: true,
643 includeSuperMembers: isInstantiated && !classElement.isNative()); 643 includeSuperMembers: isInstantiated && !classElement.isNative());
644 return checkedSetters; 644 return checkedSetters;
645 } 645 }
646 646
647 /** 647 /**
648 * Documentation wanted -- johnniwinther 648 * Documentation wanted -- johnniwinther
649 * 649 *
650 * Invariant: [classElement] must be a declaration element. 650 * Invariant: [classElement] must be a declaration element.
651 */ 651 */
652 void emitInstanceMembers(ClassElement classElement, 652 void emitInstanceMembers(ClassElement classElement,
653 CodeBuffer buffer, 653 CodeBuffer buffer,
654 bool needsLeadingComma) { 654 bool needsLeadingComma) {
655 assert(invariant(classElement, classElement.isDeclaration)); 655 assert(invariant(classElement, classElement.isDeclaration));
656 bool needsComma = needsLeadingComma; 656 bool needsComma = needsLeadingComma;
657 void defineInstanceMember(String name, CodeBuffer memberBuffer) { 657 void defineInstanceMember(String name, CodeBuffer memberBuffer) {
658 if (needsComma) buffer.add(','); 658 if (needsComma) buffer.add(',');
659 needsComma = true; 659 needsComma = true;
660 buffer.add('\n'); 660 buffer.add('\n');
661 buffer.add(' $name: '); 661 buffer.add(' $name: ');
662 buffer.add(memberBuffer); 662 buffer.add(memberBuffer);
663 } 663 }
664 664
665 classElement.forEachMember(includeBackendMembers: true, 665 classElement.implementation.forEachMember(includeBackendMembers: true,
666 f: (ClassElement enclosing, Element member) { 666 f: (ClassElement enclosing, Element member) {
667 assert(invariant(classElement, member.isDeclaration)); 667 assert(invariant(classElement, member.isDeclaration));
668 if (member.isInstanceMember()) { 668 if (member.isInstanceMember()) {
669 addInstanceMember(member, defineInstanceMember); 669 addInstanceMember(member, defineInstanceMember);
670 } 670 }
671 }); 671 });
672 672
673 generateIsTestsOn(classElement, (Element other) { 673 generateIsTestsOn(classElement, (Element other) {
674 String code; 674 String code;
675 if (other.isObject(compiler)) return; 675 if (other.isObject(compiler)) return;
676 if (nativeEmitter.requiresNativeIsCheck(other)) { 676 if (nativeEmitter.requiresNativeIsCheck(other)) {
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 const String HOOKS_API_USAGE = """ 1435 const String HOOKS_API_USAGE = """
1436 // Generated by dart2js, the Dart to JavaScript compiler. 1436 // Generated by dart2js, the Dart to JavaScript compiler.
1437 // The code supports the following hooks: 1437 // The code supports the following hooks:
1438 // dartPrint(message) - if this function is defined it is called 1438 // dartPrint(message) - if this function is defined it is called
1439 // instead of the Dart [print] method. 1439 // instead of the Dart [print] method.
1440 // dartMainRunner(main) - if this function is defined, the Dart [main] 1440 // dartMainRunner(main) - if this function is defined, the Dart [main]
1441 // method will not be invoked directly. 1441 // method will not be invoked directly.
1442 // Instead, a closure that will invoke [main] is 1442 // Instead, a closure that will invoke [main] is
1443 // passed to [dartMainRunner]. 1443 // passed to [dartMainRunner].
1444 """; 1444 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698