diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart index e792b7001d2..1ec1c4f179c 100644 --- a/pkg/compiler/lib/src/enqueue.dart +++ b/pkg/compiler/lib/src/enqueue.dart @@ -44,7 +44,7 @@ abstract class EnqueuerListener { WorldImpact registerUsedConstant(ConstantValue value); void onQueueOpen( - Enqueuer enqueuer, FunctionEntity mainMethod, Iterable libraries); + Enqueuer enqueuer, FunctionEntity? mainMethod, Iterable libraries); /// Called when [enqueuer]'s queue is empty, but before it is closed. /// @@ -115,7 +115,7 @@ abstract class Enqueuer { void processConstantUse(ConstantUse constantUse); EnqueuerListener get listener; - void open(FunctionEntity mainMethod, Iterable libraries) { + void open(FunctionEntity? mainMethod, Iterable libraries) { listener.onQueueOpen(this, mainMethod, libraries); } diff --git a/pkg/compiler/lib/src/js_backend/resolution_listener.dart b/pkg/compiler/lib/src/js_backend/resolution_listener.dart index b1b0a1ddc8b..b9939721e19 100644 --- a/pkg/compiler/lib/src/js_backend/resolution_listener.dart +++ b/pkg/compiler/lib/src/js_backend/resolution_listener.dart @@ -2,8 +2,6 @@ // 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. -// @dart = 2.10 - library js_backend.backend.resolution_listener; import '../common/elements.dart' show KCommonElements, KElementEnvironment; @@ -13,6 +11,7 @@ import '../deferred_load/deferred_load.dart'; import '../elements/entities.dart'; import '../elements/types.dart'; import '../enqueue.dart' show Enqueuer, EnqueuerListener; +import '../kernel/kelements.dart' show KClass; import '../native/enqueue.dart'; import '../options.dart' show CompilerOptions; import '../universe/call_structure.dart' show CallStructure; @@ -137,7 +136,7 @@ class ResolutionEnqueuerListener extends EnqueuerListener { @override void onQueueOpen( - Enqueuer enqueuer, FunctionEntity mainMethod, Iterable libraries) { + Enqueuer enqueuer, FunctionEntity? mainMethod, Iterable libraries) { if (_deferredLoadTask.isProgramSplit) { enqueuer.applyImpact(_computeDeferredLoadingImpact()); } @@ -160,13 +159,13 @@ class ResolutionEnqueuerListener extends EnqueuerListener { enqueuer.applyImpact(_customElementsAnalysis.flush()); for (ClassEntity cls in recentClasses) { - MemberEntity element = + MemberEntity? element = _elementEnvironment.lookupLocalClassMember(cls, Names.noSuchMethod_); if (element != null && element.isInstanceMember && element.isFunction && !element.isAbstract) { - _noSuchMethodRegistry.registerNoSuchMethod(element); + _noSuchMethodRegistry.registerNoSuchMethod(element as FunctionEntity); } } _noSuchMethodRegistry.onQueueEmpty(); @@ -253,7 +252,7 @@ class ResolutionEnqueuerListener extends EnqueuerListener { _customElementsAnalysis.registerStaticUse(member); if (member.isFunction) { - FunctionEntity function = member; + FunctionEntity function = member as FunctionEntity; if (function.isExternal) { FunctionType functionType = _elementEnvironment.getFunctionType(function); @@ -275,7 +274,7 @@ class ResolutionEnqueuerListener extends EnqueuerListener { } } if (function.isInstanceMember) { - ClassEntity cls = function.enclosingClass; + ClassEntity cls = function.enclosingClass!; if (function.name == Identifiers.call && _elementEnvironment.isGenericClass(cls)) { @@ -421,7 +420,7 @@ class ResolutionEnqueuerListener extends EnqueuerListener { @override WorldImpact registerInstantiatedClass(ClassEntity cls) { - _fieldAnalysis.registerInstantiatedClass(cls); + _fieldAnalysis.registerInstantiatedClass(cls as KClass); return _processClass(cls); } @@ -458,7 +457,8 @@ class ResolutionEnqueuerListener extends EnqueuerListener { // TODO(13155): Find a way to register fewer _commonElements. List staticUses = []; for (CheckedModeHelper helper in CheckedModeHelpers.helpers) { - staticUses.add(helper.getStaticUse(_commonElements).element); + staticUses + .add(helper.getStaticUse(_commonElements).element as FunctionEntity); } _registerBackendImpact( impactBuilder, BackendImpact(globalUses: staticUses));