| OLD | NEW |
| 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 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 } | 1895 } |
| 1896 } | 1896 } |
| 1897 | 1897 |
| 1898 visitSuperSend(Send node) { | 1898 visitSuperSend(Send node) { |
| 1899 Selector selector = elements.getSelector(node); | 1899 Selector selector = elements.getSelector(node); |
| 1900 Element element = elements[node]; | 1900 Element element = elements[node]; |
| 1901 if (element === null) { | 1901 if (element === null) { |
| 1902 // Example: co19/Language/10_Expressions/25_Unary_Expressions_A06_t01 | 1902 // Example: co19/Language/10_Expressions/25_Unary_Expressions_A06_t01 |
| 1903 compiler.unimplemented('unresolved super-send', node: node); | 1903 compiler.unimplemented('unresolved super-send', node: node); |
| 1904 } | 1904 } |
| 1905 if (element.kind.category != ElementCategory.FUNCTION) { | |
| 1906 // Example: | |
| 1907 // co19/Language/10_Expressions/14_Method_Invocation/3_Super_Invocation_A0
3_t04 | |
| 1908 compiler.unimplemented('super-send to non-function', node: node); | |
| 1909 } | |
| 1910 HStatic target = new HStatic(element); | 1905 HStatic target = new HStatic(element); |
| 1911 HInstruction context = localsHandler.readThis(); | 1906 HInstruction context = localsHandler.readThis(); |
| 1912 add(target); | 1907 add(target); |
| 1913 var inputs = <HInstruction>[target, context]; | 1908 var inputs = <HInstruction>[target, context]; |
| 1914 addStaticSendArgumentsToList(node, element, inputs); | 1909 if (element.kind == ElementKind.FUNCTION || |
| 1915 push(new HInvokeSuper(selector, inputs)); | 1910 element.kind == ElementKind.GENERATIVE_CONSTRUCTOR) { |
| 1911 addStaticSendArgumentsToList(node, element, inputs); |
| 1912 push(new HInvokeSuper(selector, inputs)); |
| 1913 } else { |
| 1914 target = new HInvokeSuper(Selector.GETTER, inputs); |
| 1915 add(target); |
| 1916 inputs = <HInstruction>[target]; |
| 1917 addDynamicSendArgumentsToList(node, inputs); |
| 1918 push(new HInvokeClosure(selector, inputs)); |
| 1919 } |
| 1916 } | 1920 } |
| 1917 | 1921 |
| 1918 visitStaticSend(Send node) { | 1922 visitStaticSend(Send node) { |
| 1919 Selector selector = elements.getSelector(node); | 1923 Selector selector = elements.getSelector(node); |
| 1920 Element element = elements[node]; | 1924 Element element = elements[node]; |
| 1921 if (element.kind === ElementKind.GENERATIVE_CONSTRUCTOR) { | 1925 if (element.kind === ElementKind.GENERATIVE_CONSTRUCTOR) { |
| 1922 compiler.resolver.resolveMethodElement(element); | 1926 compiler.resolver.resolveMethodElement(element); |
| 1923 FunctionElement functionElement = element; | 1927 FunctionElement functionElement = element; |
| 1924 element = functionElement.defaultImplementation; | 1928 element = functionElement.defaultImplementation; |
| 1925 } | 1929 } |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2805 HInstruction concat = new HAdd(target, left, right); | 2809 HInstruction concat = new HAdd(target, left, right); |
| 2806 builder.add(concat); | 2810 builder.add(concat); |
| 2807 return concat; | 2811 return concat; |
| 2808 } | 2812 } |
| 2809 | 2813 |
| 2810 HInstruction result() { | 2814 HInstruction result() { |
| 2811 flushAccumulator(); | 2815 flushAccumulator(); |
| 2812 return prefix; | 2816 return prefix; |
| 2813 } | 2817 } |
| 2814 } | 2818 } |
| OLD | NEW |