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 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 // Shouldn't be called, handled by fieldToIr. | 1918 // Shouldn't be called, handled by fieldToIr. |
1919 return internalError(node, "StaticFieldDeclaration"); | 1919 return internalError(node, "StaticFieldDeclaration"); |
1920 } | 1920 } |
1921 | 1921 |
1922 ir.Expression buildStaticGet(Element element) { | 1922 ir.Expression buildStaticGet(Element element) { |
1923 return buildStaticAccessor(element).buildSimpleRead(); | 1923 return buildStaticAccessor(element).buildSimpleRead(); |
1924 } | 1924 } |
1925 | 1925 |
1926 @override | 1926 @override |
1927 ir.Expression handleStaticFieldGet(Send node, FieldElement field, _) { | 1927 ir.Expression handleStaticFieldGet(Send node, FieldElement field, _) { |
1928 return buildStaticGet(field); | 1928 return associateNode(buildStaticGet(field), node); |
1929 } | 1929 } |
1930 | 1930 |
1931 @override | 1931 @override |
1932 ir.MethodInvocation handleStaticFieldInvoke(Send node, FieldElement field, | 1932 ir.MethodInvocation handleStaticFieldInvoke(Send node, FieldElement field, |
1933 NodeList arguments, CallStructure callStructure, _) { | 1933 NodeList arguments, CallStructure callStructure, _) { |
1934 return associateNode( | 1934 return associateNode( |
1935 buildCall(buildStaticGet(field), callStructure, arguments), node); | 1935 buildCall(buildStaticGet(field), callStructure, arguments), node); |
1936 } | 1936 } |
1937 | 1937 |
1938 @override | 1938 @override |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 isConst: isConst); | 2125 isConst: isConst); |
2126 } | 2126 } |
2127 | 2127 |
2128 @override | 2128 @override |
2129 ir.StaticInvocation handleStaticFunctionInvoke( | 2129 ir.StaticInvocation handleStaticFunctionInvoke( |
2130 Send node, | 2130 Send node, |
2131 MethodElement function, | 2131 MethodElement function, |
2132 NodeList arguments, | 2132 NodeList arguments, |
2133 CallStructure callStructure, | 2133 CallStructure callStructure, |
2134 _) { | 2134 _) { |
2135 return buildStaticInvoke(function, arguments, isConst: false); | 2135 return associateNode( |
| 2136 buildStaticInvoke(function, arguments, isConst: false), node); |
2136 } | 2137 } |
2137 | 2138 |
2138 @override | 2139 @override |
2139 ir.Expression handleStaticFunctionSet( | 2140 ir.Expression handleStaticFunctionSet( |
2140 Send node, MethodElement function, Node rhs, _) { | 2141 Send node, MethodElement function, Node rhs, _) { |
2141 return buildStaticAccessor(function) | 2142 return buildStaticAccessor(function) |
2142 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); | 2143 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); |
2143 } | 2144 } |
2144 | 2145 |
2145 @override | 2146 @override |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2750 } | 2751 } |
2751 } | 2752 } |
2752 }); | 2753 }); |
2753 } | 2754 } |
2754 | 2755 |
2755 ir.Expression buildInitializer() { | 2756 ir.Expression buildInitializer() { |
2756 return kernel.compiler.reporter.withCurrentElement(currentElement, () { | 2757 return kernel.compiler.reporter.withCurrentElement(currentElement, () { |
2757 FieldElement field = currentElement; | 2758 FieldElement field = currentElement; |
2758 return field.isMalformed | 2759 return field.isMalformed |
2759 ? new ir.InvalidExpression() | 2760 ? new ir.InvalidExpression() |
2760 : visitForValue(field.initializer); | 2761 : associateNode(visitForValue(field.initializer), field.initializer); |
2761 }); | 2762 }); |
2762 } | 2763 } |
2763 } | 2764 } |
2764 | 2765 |
2765 class VariableDeclarations implements ir.Node { | 2766 class VariableDeclarations implements ir.Node { |
2766 final List<ir.VariableDeclaration> variables; | 2767 final List<ir.VariableDeclaration> variables; |
2767 | 2768 |
2768 VariableDeclarations(this.variables); | 2769 VariableDeclarations(this.variables); |
2769 | 2770 |
2770 accept(ir.Visitor v) => throw "unsupported"; | 2771 accept(ir.Visitor v) => throw "unsupported"; |
(...skipping 19 matching lines...) Expand all Loading... |
2790 : this(null, true, node, initializers); | 2791 : this(null, true, node, initializers); |
2791 | 2792 |
2792 accept(ir.Visitor v) => throw "unsupported"; | 2793 accept(ir.Visitor v) => throw "unsupported"; |
2793 | 2794 |
2794 visitChildren(ir.Visitor v) => throw "unsupported"; | 2795 visitChildren(ir.Visitor v) => throw "unsupported"; |
2795 | 2796 |
2796 String toString() { | 2797 String toString() { |
2797 return "IrFunction($kind, $isConstructor, $node, $initializers)"; | 2798 return "IrFunction($kind, $isConstructor, $node, $initializers)"; |
2798 } | 2799 } |
2799 } | 2800 } |
OLD | NEW |