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

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

Issue 9692018: Unresolved super-send is not a compile-time error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review coments Created 8 years, 9 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 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 native.handleSsaNative(this, node); 1770 native.handleSsaNative(this, node);
1771 break; 1771 break;
1772 default: 1772 default:
1773 throw "Unknown foreign: ${node.selector}"; 1773 throw "Unknown foreign: ${node.selector}";
1774 } 1774 }
1775 } 1775 }
1776 1776
1777 visitSuperSend(Send node) { 1777 visitSuperSend(Send node) {
1778 Selector selector = elements.getSelector(node); 1778 Selector selector = elements.getSelector(node);
1779 Element element = elements[node]; 1779 Element element = elements[node];
1780 if (element === null) {
1781 // Example: co19/Language/10_Expressions/25_Unary_Expressions_A06_t01
1782 compiler.unimplemented('unresolved super-send', node: node);
1783 }
1780 if (element.kind.category != ElementCategory.FUNCTION) { 1784 if (element.kind.category != ElementCategory.FUNCTION) {
1781 // Example: 1785 // Example:
1782 // co19/Language/10_Expressions/14_Method_Invocation/3_Super_Invocation_A0 3_t04 1786 // co19/Language/10_Expressions/14_Method_Invocation/3_Super_Invocation_A0 3_t04
1783 compiler.unimplemented('super-send to non-function', node: node); 1787 compiler.unimplemented('super-send to non-function', node: node);
1784 } 1788 }
1785 HStatic target = new HStatic(element); 1789 HStatic target = new HStatic(element);
1786 HInstruction context = localsHandler.readThis(); 1790 HInstruction context = localsHandler.readThis();
1787 add(target); 1791 add(target);
1788 var inputs = <HInstruction>[target, context]; 1792 var inputs = <HInstruction>[target, context];
1789 addStaticSendArgumentsToList(node, element, inputs); 1793 addStaticSendArgumentsToList(node, element, inputs);
(...skipping 21 matching lines...) Expand all
1811 target = new HInvokeStatic(Selector.GETTER, inputs); 1815 target = new HInvokeStatic(Selector.GETTER, inputs);
1812 add(target); 1816 add(target);
1813 inputs = <HInstruction>[target]; 1817 inputs = <HInstruction>[target];
1814 } 1818 }
1815 addDynamicSendArgumentsToList(node, inputs); 1819 addDynamicSendArgumentsToList(node, inputs);
1816 push(new HInvokeClosure(selector, inputs)); 1820 push(new HInvokeClosure(selector, inputs));
1817 } 1821 }
1818 } 1822 }
1819 1823
1820 visitSend(Send node) { 1824 visitSend(Send node) {
1821 if (node.selector is Operator && methodInterceptionEnabled) { 1825 if (node.isSuperCall) {
1826 if (node.isPropertyAccess) {
1827 compiler.unimplemented('super property read', node: node);
1828 }
1829 visitSuperSend(node);
1830 } else if (node.selector is Operator && methodInterceptionEnabled) {
1822 visitOperatorSend(node); 1831 visitOperatorSend(node);
1823 } else if (node.isPropertyAccess) { 1832 } else if (node.isPropertyAccess) {
1824 generateGetter(node, elements[node]); 1833 generateGetter(node, elements[node]);
1825 } else if (Elements.isClosureSend(node, elements)) { 1834 } else if (Elements.isClosureSend(node, elements)) {
1826 visitClosureSend(node); 1835 visitClosureSend(node);
1827 } else if (node.isSuperCall) {
1828 visitSuperSend(node);
1829 } else { 1836 } else {
1830 Element element = elements[node]; 1837 Element element = elements[node];
1831 if (element === null) { 1838 if (element === null) {
1832 // Example: f() with 'f' unbound. 1839 // Example: f() with 'f' unbound.
1833 // This can only happen inside an instance method. 1840 // This can only happen inside an instance method.
1834 visitDynamicSend(node); 1841 visitDynamicSend(node);
1835 } else if (element.kind == ElementKind.CLASS) { 1842 } else if (element.kind == ElementKind.CLASS) {
1836 compiler.internalError("Cannot generate code for send", node: node); 1843 compiler.internalError("Cannot generate code for send", node: node);
1837 } else if (element.isInstanceMember()) { 1844 } else if (element.isInstanceMember()) {
1838 // Example: f() with 'f' bound to instance method. 1845 // Example: f() with 'f' bound to instance method.
1839 visitDynamicSend(node); 1846 visitDynamicSend(node);
1840 } else if (element.kind === ElementKind.FOREIGN) { 1847 } else if (element.kind === ElementKind.FOREIGN) {
1841 visitForeignSend(node); 1848 visitForeignSend(node);
1842 } else if (!element.isInstanceMember()) { 1849 } else if (!element.isInstanceMember()) {
1843 // Example: A.f() or f() with 'f' bound to a static function. 1850 // Example: A.f() or f() with 'f' bound to a static function.
1844 // Also includes new A() or new A.named() which is treated like a 1851 // Also includes new A() or new A.named() which is treated like a
1845 // static call to a factory. 1852 // static call to a factory.
1846 visitStaticSend(node); 1853 visitStaticSend(node);
1847 } else { 1854 } else {
1848 compiler.internalError("Cannot generate code for send", node: node); 1855 compiler.internalError("Cannot generate code for send", node: node);
1849 } 1856 }
1850 } 1857 }
1851 } 1858 }
1852 1859
1853 visitNewExpression(NewExpression node) => visitSend(node.send); 1860 visitNewExpression(NewExpression node) => visitSend(node.send);
1854 1861
1855 visitSendSet(SendSet node) { 1862 visitSendSet(SendSet node) {
1856 Operator op = node.assignmentOperator; 1863 Operator op = node.assignmentOperator;
1857 if (node.isIndex) { 1864 if (node.isSuperCall) {
1865 compiler.unimplemented('super property store', node: node);
1866 } else if (node.isIndex) {
1858 if (!methodInterceptionEnabled) { 1867 if (!methodInterceptionEnabled) {
1859 assert(op.source.stringValue === '='); 1868 assert(op.source.stringValue === '=');
1860 visitDynamicSend(node); 1869 visitDynamicSend(node);
1861 } else { 1870 } else {
1862 HStatic target = new HStatic( 1871 HStatic target = new HStatic(
1863 interceptors.getIndexAssignmentInterceptor()); 1872 interceptors.getIndexAssignmentInterceptor());
1864 add(target); 1873 add(target);
1865 visit(node.receiver); 1874 visit(node.receiver);
1866 HInstruction receiver = pop(); 1875 HInstruction receiver = pop();
1867 visit(node.argumentsNode); 1876 visit(node.argumentsNode);
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 buildBody() { 2493 buildBody() {
2485 // TODO(lrn): Make sure to take continue into account. 2494 // TODO(lrn): Make sure to take continue into account.
2486 visit(body); 2495 visit(body);
2487 if (isAborted()) { 2496 if (isAborted()) {
2488 compiler.reportWarning(body, "aborting loop body"); 2497 compiler.reportWarning(body, "aborting loop body");
2489 } 2498 }
2490 } 2499 }
2491 handleIf(buildBody, null); 2500 handleIf(buildBody, null);
2492 } 2501 }
2493 } 2502 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698