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

Unified Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2915523003: Create new interface instead of ClosureClassMap for variable usage information that is not Element-…
Patch Set: merge with master Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 05cb6cb3900731b10325efdd85564b7da9cdeeba..02404ff994bc75fa2aa1efaae3b842452a6918f1 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -594,9 +594,9 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
// Set the locals handler state as if we were inlining the constructor.
ConstructorEntity astElement = _elementMap.getConstructor(constructor);
- ClosureClassMap oldClosureData = localsHandler.closureData;
- ClosureClassMap newClosureData =
- closureToClassMapper.getMemberMap(astElement);
+ ClosureRepresentationInfo oldClosureData = localsHandler.closureData;
+ ClosureRepresentationInfo newClosureData =
+ closureToClassMapper.getClosureRepresentationInfo(astElement);
if (astElement is ConstructorElement) {
// TODO(johnniwinther): Support constructor (body) entities.
ResolvedAst resolvedAst = astElement.resolvedAst;
@@ -2835,26 +2835,23 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
@override
visitFunctionNode(ir.FunctionNode node) {
Local methodElement = _elementMap.getLocalFunction(node);
- ClosureClassMap nestedClosureData =
- closureToClassMapper.getLocalFunctionMap(methodElement);
- assert(nestedClosureData != null);
- assert(nestedClosureData.closureClassElement != null);
- ClosureClassElement closureClassElement =
- nestedClosureData.closureClassElement;
- MethodElement callElement = nestedClosureData.callElement;
+ // TODO(efortuna): Rewrite this so we're not reaching into the
+ // closureToClassMapper. We're instead asking it to do something on our
+ // behalf.
+ ClosureRepresentationInfo closureInfo =
+ closureToClassMapper.getClosureRepresentationInfo(methodElement);
+ ClassEntity closureClassEntity = closureInfo.closureClassEntity;
List<HInstruction> capturedVariables = <HInstruction>[];
- closureClassElement.closureFields.forEach((ClosureFieldElement field) {
- Local capturedLocal =
- nestedClosureData.getLocalVariableForClosureField(field);
+ closureInfo.createdFieldEntities.forEach((Local capturedLocal) {
assert(capturedLocal != null);
capturedVariables.add(localsHandler.readLocal(capturedLocal));
});
- TypeMask type = new TypeMask.nonNullExact(closureClassElement, closedWorld);
+ TypeMask type = new TypeMask.nonNullExact(closureClassEntity, closedWorld);
// TODO(efortuna): Add source information here.
- push(new HCreate(closureClassElement, capturedVariables, type,
- callMethod: callElement, localFunction: methodElement));
+ push(new HCreate(closureClassEntity, capturedVariables, type,
+ callMethod: closureInfo.callEntity, localFunction: methodElement));
}
@override
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698