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

Side by Side Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 2667473003: Move Entity and Local to entities.dart (Closed)
Patch Set: Created 3 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
OLDNEW
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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:js_runtime/shared/embedded_names.dart'; 5 import 'package:js_runtime/shared/embedded_names.dart';
6 import 'package:kernel/ast.dart' as ir; 6 import 'package:kernel/ast.dart' as ir;
7 7
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart'; 9 import '../common/names.dart';
10 import '../compiler.dart'; 10 import '../compiler.dart';
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 getElement(node).declaration; 133 getElement(node).declaration;
134 134
135 MemberElement getMember(ir.Member node) => getElement(node).declaration; 135 MemberElement getMember(ir.Member node) => getElement(node).declaration;
136 136
137 MethodElement getMethod(ir.Procedure node) => getElement(node).declaration; 137 MethodElement getMethod(ir.Procedure node) => getElement(node).declaration;
138 138
139 FieldElement getField(ir.Field node) => getElement(node).declaration; 139 FieldElement getField(ir.Field node) => getElement(node).declaration;
140 140
141 ClassElement getClass(ir.Class node) => getElement(node).declaration; 141 ClassElement getClass(ir.Class node) => getElement(node).declaration;
142 142
143 LibraryElement getLibrary(ir.Library node) => getElement(node).declaration;
144
143 LocalFunctionElement getLocalFunction(ir.Node node) => getElement(node); 145 LocalFunctionElement getLocalFunction(ir.Node node) => getElement(node);
144 146
145 ast.Node getNode(ir.Node node) { 147 ast.Node getNode(ir.Node node) {
146 ast.Node result = _nodeToAst[node]; 148 ast.Node result = _nodeToAst[node];
147 assert(invariant(CURRENT_ELEMENT_SPANNABLE, result != null, 149 assert(invariant(CURRENT_ELEMENT_SPANNABLE, result != null,
148 message: "No node found for $node")); 150 message: "No node found for $node"));
149 return result; 151 return result;
150 } 152 }
151 153
152 ast.Node getNodeOrNull(ir.Node node) { 154 ast.Node getNodeOrNull(ir.Node node) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 List<String> namedArguments = arguments.named.map((e) => e.name).toList(); 189 List<String> namedArguments = arguments.named.map((e) => e.name).toList();
188 return new CallStructure(argumentCount, namedArguments); 190 return new CallStructure(argumentCount, namedArguments);
189 } 191 }
190 192
191 FunctionSignature getFunctionSignature(ir.FunctionNode function) { 193 FunctionSignature getFunctionSignature(ir.FunctionNode function) {
192 return getElement(function).asFunctionElement().functionSignature; 194 return getElement(function).asFunctionElement().functionSignature;
193 } 195 }
194 196
195 Name getName(ir.Name name) { 197 Name getName(ir.Name name) {
196 return new Name( 198 return new Name(
197 name.name, name.isPrivate ? getElement(name.library) : null); 199 name.name, name.isPrivate ? getLibrary(name.library) : null);
198 } 200 }
199 201
200 ir.Field getFieldFromElement(FieldElement field) { 202 ir.Field getFieldFromElement(FieldElement field) {
201 return kernel.fields[field]; 203 return kernel.fields[field];
202 } 204 }
203 205
204 Selector getSelector(ir.Expression node) { 206 Selector getSelector(ir.Expression node) {
205 if (node is ir.PropertyGet) return getGetterSelector(node); 207 if (node is ir.PropertyGet) return getGetterSelector(node);
206 if (node is ir.PropertySet) return getSetterSelector(node); 208 if (node is ir.PropertySet) return getSetterSelector(node);
207 if (node is ir.InvocationExpression) return getInvocationSelector(node); 209 if (node is ir.InvocationExpression) return getInvocationSelector(node);
(...skipping 15 matching lines...) Expand all
223 kind = SelectorKind.CALL; 225 kind = SelectorKind.CALL;
224 } 226 }
225 227
226 CallStructure callStructure = getCallStructure(invocation.arguments); 228 CallStructure callStructure = getCallStructure(invocation.arguments);
227 return new Selector(kind, name, callStructure); 229 return new Selector(kind, name, callStructure);
228 } 230 }
229 231
230 Selector getGetterSelector(ir.PropertyGet getter) { 232 Selector getGetterSelector(ir.PropertyGet getter) {
231 ir.Name irName = getter.name; 233 ir.Name irName = getter.name;
232 Name name = new Name( 234 Name name = new Name(
233 irName.name, irName.isPrivate ? getElement(irName.library) : null); 235 irName.name, irName.isPrivate ? getLibrary(irName.library) : null);
234 return new Selector.getter(name); 236 return new Selector.getter(name);
235 } 237 }
236 238
237 Selector getSetterSelector(ir.PropertySet setter) { 239 Selector getSetterSelector(ir.PropertySet setter) {
238 ir.Name irName = setter.name; 240 ir.Name irName = setter.name;
239 Name name = new Name( 241 Name name = new Name(
240 irName.name, irName.isPrivate ? getElement(irName.library) : null); 242 irName.name, irName.isPrivate ? getLibrary(irName.library) : null);
241 return new Selector.setter(name); 243 return new Selector.setter(name);
242 } 244 }
243 245
244 TypeMask typeOfInvocation(ir.MethodInvocation send, ClosedWorld closedWorld) { 246 TypeMask typeOfInvocation(ir.MethodInvocation send, ClosedWorld closedWorld) {
245 ast.Node operatorNode = kernel.nodeToAstOperator[send]; 247 ast.Node operatorNode = kernel.nodeToAstOperator[send];
246 if (operatorNode != null) { 248 if (operatorNode != null) {
247 return _resultOf(_target).typeOfOperator(operatorNode); 249 return _resultOf(_target).typeOfOperator(operatorNode);
248 } 250 }
249 if (send.name.name == '[]=') { 251 if (send.name.name == '[]=') {
250 return closedWorld.commonMasks.dynamicType; 252 return closedWorld.commonMasks.dynamicType;
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 LabelDefinition addLabel(ast.Label label, String labelName) { 1063 LabelDefinition addLabel(ast.Label label, String labelName) {
1062 LabelDefinition result = new LabelDefinitionX(label, labelName, this); 1064 LabelDefinition result = new LabelDefinitionX(label, labelName, this);
1063 labels.add(result); 1065 labels.add(result);
1064 return result; 1066 return result;
1065 } 1067 }
1066 1068
1067 @override 1069 @override
1068 ExecutableElement get executableContext => null; 1070 ExecutableElement get executableContext => null;
1069 1071
1070 @override 1072 @override
1073 MemberElement get memberContext => null;
1074
1075 @override
1071 bool get isSwitch => targetStatement is ir.SwitchStatement; 1076 bool get isSwitch => targetStatement is ir.SwitchStatement;
1072 1077
1073 @override 1078 @override
1074 bool get isTarget => isBreakTarget || isContinueTarget; 1079 bool get isTarget => isBreakTarget || isContinueTarget;
1075 1080
1076 @override 1081 @override
1077 List<LabelDefinition> labels; 1082 List<LabelDefinition> labels;
1078 1083
1079 @override 1084 @override
1080 String get name => 'target'; 1085 String get name => 'target';
(...skipping 28 matching lines...) Expand all
1109 JumpTarget continueTarget = 1114 JumpTarget continueTarget =
1110 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); 1115 astAdapter.getJumpTarget(switchCase, isContinueTarget: true);
1111 assert(continueTarget is KernelJumpTarget); 1116 assert(continueTarget is KernelJumpTarget);
1112 targetIndexMap[continueTarget] = switchIndex; 1117 targetIndexMap[continueTarget] = switchIndex;
1113 assert(builder.jumpTargets[continueTarget] == null); 1118 assert(builder.jumpTargets[continueTarget] == null);
1114 builder.jumpTargets[continueTarget] = this; 1119 builder.jumpTargets[continueTarget] = this;
1115 switchIndex++; 1120 switchIndex++;
1116 } 1121 }
1117 } 1122 }
1118 } 1123 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/graph_builder.dart ('k') | pkg/compiler/lib/src/ssa/locals_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698