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

Side by Side Diff: frog/leg/ssa/builder.dart

Issue 9245002: Support getters and setters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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 | 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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 push(new HNot(bl)); 776 push(new HNot(bl));
777 break; 777 break;
778 default: compiler.unimplemented("SsaBuilder.visitBinary"); 778 default: compiler.unimplemented("SsaBuilder.visitBinary");
779 } 779 }
780 } 780 }
781 781
782 void generateGetter(Send send, Element element) { 782 void generateGetter(Send send, Element element) {
783 Selector selector = elements.getSelector(send); 783 Selector selector = elements.getSelector(send);
784 if (Elements.isStaticOrTopLevelField(element)) { 784 if (Elements.isStaticOrTopLevelField(element)) {
785 push(new HStatic(element)); 785 push(new HStatic(element));
786 } else if (element === null || Elements.isInstanceField(element)) { 786 if (element.kind == ElementKind.GETTER) {
787 push(new HInvokeStatic(selector, <HInstruction>[pop()]));
788 }
789 } else if (element === null
790 || Elements.isInstanceField(element)) {
karlklose 2012/02/01 14:17:06 Does it fit in one line?
ngeoffray 2012/02/01 15:57:12 Done.
787 HInstruction receiver; 791 HInstruction receiver;
788 if (send.receiver == null) { 792 if (send.receiver == null) {
789 receiver = thisDefinition; 793 receiver = thisDefinition;
790 if (receiver === null) { 794 if (receiver === null) {
791 compiler.unimplemented("SsaBuilder.generateGetter.", node: send); 795 compiler.unimplemented("SsaBuilder.generateGetter.", node: send);
792 } 796 }
793 } else { 797 } else {
794 visit(send.receiver); 798 visit(send.receiver);
795 receiver = pop(); 799 receiver = pop();
796 } 800 }
(...skipping 16 matching lines...) Expand all
813 compiler.unimplemented("SsaBuilder.visitSend with static", node: send); 817 compiler.unimplemented("SsaBuilder.visitSend with static", node: send);
814 } 818 }
815 assert(instruction !== null); 819 assert(instruction !== null);
816 stack.add(instruction); 820 stack.add(instruction);
817 } 821 }
818 } 822 }
819 823
820 void generateSetter(SendSet send, Element element, HInstruction value) { 824 void generateSetter(SendSet send, Element element, HInstruction value) {
821 Selector selector = elements.getSelector(send); 825 Selector selector = elements.getSelector(send);
822 if (Elements.isStaticOrTopLevelField(element)) { 826 if (Elements.isStaticOrTopLevelField(element)) {
823 add(new HStaticStore(element, value)); 827 if (element.kind == ElementKind.SETTER) {
828 HStatic target = new HStatic(element);
829 add(target);
830 add(new HInvokeStatic(selector, <HInstruction>[target, value]));
831 } else {
832 add(new HStaticStore(element, value));
833 }
824 stack.add(value); 834 stack.add(value);
825 } else if (Elements.isInstanceField(element)) { 835 } else if (element === null
karlklose 2012/02/01 14:17:06 ditto.
ngeoffray 2012/02/01 15:57:12 Done.
826 SourceString methodName = element.name; 836 || Elements.isInstanceField(element)) {
827 HInstruction receiver = thisDefinition;
828 if (receiver === null) {
829 compiler.unimplemented("Ssa.generateSetter.", node: send);
830 }
831 add(new HInvokeDynamicSetter(
832 selector, element, methodName, receiver, value));
833 stack.add(value);
834 } else if (element === null) {
835 SourceString dartSetterName = send.selector.asIdentifier().source; 837 SourceString dartSetterName = send.selector.asIdentifier().source;
836 HInstruction receiver; 838 HInstruction receiver;
837 if (send.receiver == null) { 839 if (send.receiver == null) {
838 receiver = thisDefinition; 840 receiver = thisDefinition;
839 if (receiver === null) { 841 if (receiver === null) {
840 compiler.unimplemented("Ssa.generateSetter.", node: send); 842 compiler.unimplemented("Ssa.generateSetter.", node: send);
841 } 843 }
842 } else { 844 } else {
843 visit(send.receiver); 845 visit(send.receiver);
844 receiver = pop(); 846 receiver = pop();
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 } 1504 }
1503 1505
1504 visitCatchBlock(CatchBlock node) { 1506 visitCatchBlock(CatchBlock node) {
1505 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); 1507 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node);
1506 } 1508 }
1507 1509
1508 visitTypedef(Typedef node) { 1510 visitTypedef(Typedef node) {
1509 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); 1511 compiler.unimplemented('SsaBuilder.visitTypedef', node: node);
1510 } 1512 }
1511 } 1513 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698