OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
6 import 'package:kernel/frontend/accessors.dart' | 6 import 'package:kernel/frontend/accessors.dart' |
7 show | 7 show |
8 Accessor, | 8 Accessor, |
9 IndexAccessor, | 9 IndexAccessor, |
10 NullAwarePropertyAccessor, | 10 NullAwarePropertyAccessor, |
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 // Shouldn't be called, handled by fieldToIr. | 1923 // Shouldn't be called, handled by fieldToIr. |
1924 return internalError(node, "StaticFieldDeclaration"); | 1924 return internalError(node, "StaticFieldDeclaration"); |
1925 } | 1925 } |
1926 | 1926 |
1927 ir.Expression buildStaticGet(Element element) { | 1927 ir.Expression buildStaticGet(Element element) { |
1928 return buildStaticAccessor(element).buildSimpleRead(); | 1928 return buildStaticAccessor(element).buildSimpleRead(); |
1929 } | 1929 } |
1930 | 1930 |
1931 @override | 1931 @override |
1932 ir.Expression handleStaticFieldGet(Send node, FieldElement field, _) { | 1932 ir.Expression handleStaticFieldGet(Send node, FieldElement field, _) { |
1933 return buildStaticGet(field); | 1933 return associateNode(buildStaticGet(field), node); |
1934 } | 1934 } |
1935 | 1935 |
1936 @override | 1936 @override |
1937 ir.MethodInvocation handleStaticFieldInvoke(Send node, FieldElement field, | 1937 ir.MethodInvocation handleStaticFieldInvoke(Send node, FieldElement field, |
1938 NodeList arguments, CallStructure callStructure, _) { | 1938 NodeList arguments, CallStructure callStructure, _) { |
1939 return associateNode( | 1939 return associateNode( |
1940 buildCall(buildStaticGet(field), callStructure, arguments), node); | 1940 buildCall(buildStaticGet(field), callStructure, arguments), node); |
1941 } | 1941 } |
1942 | 1942 |
1943 @override | 1943 @override |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 isConst: isConst); | 2130 isConst: isConst); |
2131 } | 2131 } |
2132 | 2132 |
2133 @override | 2133 @override |
2134 ir.StaticInvocation handleStaticFunctionInvoke( | 2134 ir.StaticInvocation handleStaticFunctionInvoke( |
2135 Send node, | 2135 Send node, |
2136 MethodElement function, | 2136 MethodElement function, |
2137 NodeList arguments, | 2137 NodeList arguments, |
2138 CallStructure callStructure, | 2138 CallStructure callStructure, |
2139 _) { | 2139 _) { |
2140 return buildStaticInvoke(function, arguments, isConst: false); | 2140 return associateNode( |
| 2141 buildStaticInvoke(function, arguments, isConst: false), node); |
2141 } | 2142 } |
2142 | 2143 |
2143 @override | 2144 @override |
2144 ir.Expression handleStaticFunctionSet( | 2145 ir.Expression handleStaticFunctionSet( |
2145 Send node, MethodElement function, Node rhs, _) { | 2146 Send node, MethodElement function, Node rhs, _) { |
2146 return buildStaticAccessor(function) | 2147 return buildStaticAccessor(function) |
2147 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); | 2148 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); |
2148 } | 2149 } |
2149 | 2150 |
2150 @override | 2151 @override |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2755 } | 2756 } |
2756 } | 2757 } |
2757 }); | 2758 }); |
2758 } | 2759 } |
2759 | 2760 |
2760 ir.Expression buildInitializer() { | 2761 ir.Expression buildInitializer() { |
2761 return kernel.compiler.reporter.withCurrentElement(currentElement, () { | 2762 return kernel.compiler.reporter.withCurrentElement(currentElement, () { |
2762 FieldElement field = currentElement; | 2763 FieldElement field = currentElement; |
2763 return field.isMalformed | 2764 return field.isMalformed |
2764 ? new ir.InvalidExpression() | 2765 ? new ir.InvalidExpression() |
2765 : visitForValue(field.initializer); | 2766 : associateNode(visitForValue(field.initializer), field.initializer); |
2766 }); | 2767 }); |
2767 } | 2768 } |
2768 } | 2769 } |
2769 | 2770 |
2770 class VariableDeclarations implements ir.Node { | 2771 class VariableDeclarations implements ir.Node { |
2771 final List<ir.VariableDeclaration> variables; | 2772 final List<ir.VariableDeclaration> variables; |
2772 | 2773 |
2773 VariableDeclarations(this.variables); | 2774 VariableDeclarations(this.variables); |
2774 | 2775 |
2775 accept(ir.Visitor v) => throw "unsupported"; | 2776 accept(ir.Visitor v) => throw "unsupported"; |
(...skipping 19 matching lines...) Expand all Loading... |
2795 : this(null, true, node, initializers); | 2796 : this(null, true, node, initializers); |
2796 | 2797 |
2797 accept(ir.Visitor v) => throw "unsupported"; | 2798 accept(ir.Visitor v) => throw "unsupported"; |
2798 | 2799 |
2799 visitChildren(ir.Visitor v) => throw "unsupported"; | 2800 visitChildren(ir.Visitor v) => throw "unsupported"; |
2800 | 2801 |
2801 String toString() { | 2802 String toString() { |
2802 return "IrFunction($kind, $isConstructor, $node, $initializers)"; | 2803 return "IrFunction($kind, $isConstructor, $node, $initializers)"; |
2803 } | 2804 } |
2804 } | 2805 } |
OLD | NEW |