Skip to content

Commit

Permalink
[dart2js] Use reporter.withCurrentElement in createClosureEntities
Browse files Browse the repository at this point in the history
This should help investigation of #47916.

Change-Id: I1db9d97e963593ab7f8778c8470328419633155d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226220
Reviewed-by: Sigmund Cherem <[email protected]>
Commit-Queue: Stephen Adams <[email protected]>
  • Loading branch information
rakudrama authored and Commit Bot committed Jan 5, 2022
1 parent 2117164 commit b053f2c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions pkg/compiler/lib/src/js_model/closure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class ClosureDataImpl implements ClosureData {
/// http://matt.might.net/articles/closure-conversion/.
class ClosureDataBuilder {
final DiagnosticReporter _reporter;
final JsToElementMap _elementMap;
final AnnotationsData _annotationsData;

Expand All @@ -185,7 +186,7 @@ class ClosureDataBuilder {

final Map<MemberEntity, MemberEntity> _enclosingMembers = {};

ClosureDataBuilder(this._elementMap, this._annotationsData);
ClosureDataBuilder(this._reporter, this._elementMap, this._annotationsData);

void _updateScopeBasedOnRtiNeed(KernelScopeInfo scope, ClosureRtiNeed rtiNeed,
MemberEntity outermostEntity) {
Expand Down Expand Up @@ -323,7 +324,7 @@ class ClosureDataBuilder {
Map<MemberEntity, ClosureScopeModel> closureModels,
ClosureRtiNeed rtiNeed,
List<FunctionEntity> callMethods) {
closureModels.forEach((MemberEntity member, ClosureScopeModel model) {
void processModel(MemberEntity member, ClosureScopeModel model) {
Map<ir.VariableDeclaration, JRecordField> allBoxedVariables =
_elementMap.makeRecordContainer(model.scopeInfo, member);
_scopeMap[member] = JsScopeInfo.from(
Expand Down Expand Up @@ -381,6 +382,12 @@ class ClosureDataBuilder {
}
callMethods.add(closureClassInfo.callMethod);
}
}

closureModels.forEach((MemberEntity member, ClosureScopeModel model) {
_reporter.withCurrentElement(member, () {
processModel(member, model);
});
});
return ClosureDataImpl(
_elementMap,
Expand Down
4 changes: 2 additions & 2 deletions pkg/compiler/lib/src/js_model/js_strategy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ class JsBackendStrategy implements BackendStrategy {
strategy.elementMap,
closedWorld.liveMemberUsage,
closedWorld.annotationsData);
ClosureDataBuilder closureDataBuilder =
ClosureDataBuilder(_elementMap, closedWorld.annotationsData);
ClosureDataBuilder closureDataBuilder = ClosureDataBuilder(
_compiler.reporter, _elementMap, closedWorld.annotationsData);
JsClosedWorldBuilder closedWorldBuilder = JsClosedWorldBuilder(_elementMap,
closureDataBuilder, _compiler.options, _compiler.abstractValueStrategy);
JClosedWorld jClosedWorld = closedWorldBuilder.convertClosedWorld(
Expand Down

0 comments on commit b053f2c

Please sign in to comment.