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

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: Replaced includeInjectedMembers by implementation 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 } 629 }
630 } 630 }
631 buffer.add('"'); 631 buffer.add('"');
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.implementation.forEachInstanceField(
640 addField, 640 addField,
641 includeBackendMembers: true, 641 includeBackendMembers: true,
642 includeSuperMembers: isInstantiated && !classElement.isNative()); 642 includeSuperMembers: isInstantiated && !classElement.isNative());
643 return checkedSetters; 643 return checkedSetters;
644 } 644 }
645 645
646 /** 646 /**
647 * Documentation wanted -- johnniwinther 647 * Documentation wanted -- johnniwinther
648 * 648 *
649 * Invariant: [classElement] must be a declaration element. 649 * Invariant: [classElement] must be a declaration element.
650 */ 650 */
651 void emitInstanceMembers(ClassElement classElement, 651 void emitInstanceMembers(ClassElement classElement,
652 CodeBuffer buffer, 652 CodeBuffer buffer,
653 bool needsLeadingComma) { 653 bool needsLeadingComma) {
654 assert(invariant(classElement, classElement.isDeclaration)); 654 assert(invariant(classElement, classElement.isDeclaration));
655 bool needsComma = needsLeadingComma; 655 bool needsComma = needsLeadingComma;
656 void defineInstanceMember(String name, CodeBuffer memberBuffer) { 656 void defineInstanceMember(String name, CodeBuffer memberBuffer) {
657 if (needsComma) buffer.add(','); 657 if (needsComma) buffer.add(',');
658 needsComma = true; 658 needsComma = true;
659 buffer.add('\n'); 659 buffer.add('\n');
660 buffer.add(' $name: '); 660 buffer.add(' $name: ');
661 buffer.add(memberBuffer); 661 buffer.add(memberBuffer);
662 } 662 }
663 663
664 classElement.forEachMember(includeBackendMembers: true, 664 classElement.implementation.forEachMember(includeBackendMembers: true,
665 f: (ClassElement enclosing, Element member) { 665 f: (ClassElement enclosing, Element member) {
666 assert(invariant(classElement, member.isDeclaration)); 666 assert(invariant(classElement, member.isDeclaration));
667 if (member.isInstanceMember()) { 667 if (member.isInstanceMember()) {
668 addInstanceMember(member, defineInstanceMember); 668 addInstanceMember(member, defineInstanceMember);
669 } 669 }
670 }); 670 });
671 671
672 generateIsTestsOn(classElement, (Element other) { 672 generateIsTestsOn(classElement, (Element other) {
673 String code; 673 String code;
674 if (nativeEmitter.requiresNativeIsCheck(other)) { 674 if (nativeEmitter.requiresNativeIsCheck(other)) {
675 code = 'function() { return true; }'; 675 code = 'function() { return true; }';
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 const String HOOKS_API_USAGE = """ 1434 const String HOOKS_API_USAGE = """
1435 // Generated by dart2js, the Dart to JavaScript compiler. 1435 // Generated by dart2js, the Dart to JavaScript compiler.
1436 // The code supports the following hooks: 1436 // The code supports the following hooks:
1437 // dartPrint(message) - if this function is defined it is called 1437 // dartPrint(message) - if this function is defined it is called
1438 // instead of the Dart [print] method. 1438 // instead of the Dart [print] method.
1439 // dartMainRunner(main) - if this function is defined, the Dart [main] 1439 // dartMainRunner(main) - if this function is defined, the Dart [main]
1440 // method will not be invoked directly. 1440 // method will not be invoked directly.
1441 // Instead, a closure that will invoke [main] is 1441 // Instead, a closure that will invoke [main] is
1442 // passed to [dartMainRunner]. 1442 // passed to [dartMainRunner].
1443 """; 1443 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698