[dart2js] migrate ir/modular.dart

Change-Id: Ica0332ccd9aebfa32ded6a4c17dd49f9573633b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260300
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
This commit is contained in:
Sigmund Cherem 2022-09-23 00:28:58 +00:00 committed by Commit Bot
parent bba48857a6
commit 9d8ea01862
2 changed files with 8 additions and 7 deletions

View file

@ -28,8 +28,8 @@ class ImpactBuilder extends StaticTypeVisitor implements ImpactRegistry {
final ImpactData _data = ImpactData(); final ImpactData _data = ImpactData();
final KernelToElementMapForImpactData _elementMap; final KernelToElementMapForImpactData _elementMap;
@override // Note: this may be null for builders associated with abstract methods.
final VariableScopeModel variableScopeModel; final VariableScopeModel? _variableScopeModel;
@override @override
final ir.StaticTypeContext staticTypeContext; final ir.StaticTypeContext staticTypeContext;
@ -45,12 +45,15 @@ class ImpactBuilder extends StaticTypeVisitor implements ImpactRegistry {
this.staticTypeContext, this.staticTypeContext,
StaticTypeCacheImpl staticTypeCache, StaticTypeCacheImpl staticTypeCache,
ir.ClassHierarchy classHierarchy, ir.ClassHierarchy classHierarchy,
this.variableScopeModel, this._variableScopeModel,
{this.useAsserts = false, {this.useAsserts = false,
this.inferEffectivelyFinalVariableTypes = true}) this.inferEffectivelyFinalVariableTypes = true})
: super( : super(
staticTypeContext.typeEnvironment, classHierarchy, staticTypeCache); staticTypeContext.typeEnvironment, classHierarchy, staticTypeCache);
@override
VariableScopeModel get variableScopeModel => _variableScopeModel!;
CommonElements get _commonElements => _elementMap.commonElements; CommonElements get _commonElements => _elementMap.commonElements;
DiagnosticReporter get _reporter => _elementMap.reporter; DiagnosticReporter get _reporter => _elementMap.reporter;

View file

@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a // for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file. // BSD-style license that can be found in the LICENSE file.
// @dart = 2.10
import 'package:kernel/ast.dart' as ir; import 'package:kernel/ast.dart' as ir;
import 'package:kernel/type_environment.dart' as ir; import 'package:kernel/type_environment.dart' as ir;
@ -49,7 +47,7 @@ class ModuleData {
// TODO(joshualitt) Support serializing ModularMemberData; // TODO(joshualitt) Support serializing ModularMemberData;
final Map<Uri, Map<ir.Member, ImpactBuilderData>> impactData; final Map<Uri, Map<ir.Member, ImpactBuilderData>> impactData;
ModuleData([Map<Uri, Map<ir.Member, ImpactBuilderData>> impactData]) ModuleData([Map<Uri, Map<ir.Member, ImpactBuilderData>>? impactData])
: this.impactData = impactData ?? {}; : this.impactData = impactData ?? {};
factory ModuleData.fromImpactData( factory ModuleData.fromImpactData(
@ -118,7 +116,7 @@ void reportLocatedMessage(DiagnosticReporter reporter,
DiagnosticMessage _createDiagnosticMessage( DiagnosticMessage _createDiagnosticMessage(
DiagnosticReporter reporter, ir.LocatedMessage message) { DiagnosticReporter reporter, ir.LocatedMessage message) {
var sourceSpan = SourceSpan( var sourceSpan = SourceSpan(
message.uri, message.charOffset, message.charOffset + message.length); message.uri!, message.charOffset, message.charOffset + message.length);
return reporter.createMessage( return reporter.createMessage(
sourceSpan, MessageKind.GENERIC, {'text': message.problemMessage}); sourceSpan, MessageKind.GENERIC, {'text': message.problemMessage});
} }