mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 14:32:24 +00:00
[dart2js] Modernize allocations in js_backend/
- Use `{}` syntax for Maps and Sets - Remove type arguments on right side of initializations with same type arguments. - A few cases of replacing conditional code with `??`/`??=`. Change-Id: I1b58a109b1f8ea8458f37a2de256ffb3dc9956b1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213853 Reviewed-by: Joshua Litt <joshualitt@google.com> Commit-Queue: Stephen Adams <sra@google.com>
This commit is contained in:
parent
b2347f66ce
commit
d4385e620d
19 changed files with 135 additions and 159 deletions
|
@ -50,10 +50,10 @@ class FunctionInlineCache {
|
|||
static const int _canInlineInLoopMayInlineOutside = 3;
|
||||
static const int _canInline = 4;
|
||||
|
||||
final Map<FunctionEntity, int> _cachedDecisions = Map<FunctionEntity, int>();
|
||||
final Map<FunctionEntity, int> _cachedDecisions = {};
|
||||
|
||||
final Set<FunctionEntity> _noInlineFunctions = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> _tryInlineFunctions = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> _noInlineFunctions = {};
|
||||
final Set<FunctionEntity> _tryInlineFunctions = {};
|
||||
|
||||
FunctionInlineCache(AnnotationsData annotationsData) {
|
||||
annotationsData.forEachNoInline((FunctionEntity function) {
|
||||
|
|
|
@ -33,15 +33,14 @@ class BackendImpact {
|
|||
final EnumSet<BackendFeature> _features;
|
||||
|
||||
const BackendImpact(
|
||||
{this.staticUses = const <FunctionEntity>[],
|
||||
this.globalUses = const <FunctionEntity>[],
|
||||
this.dynamicUses = const <Selector>[],
|
||||
this.instantiatedTypes = const <InterfaceType>[],
|
||||
this.instantiatedClasses = const <ClassEntity>[],
|
||||
this.globalClasses = const <ClassEntity>[],
|
||||
this.otherImpacts = const <BackendImpact>[],
|
||||
EnumSet<BackendFeature> features =
|
||||
const EnumSet<BackendFeature>.fixed(0)})
|
||||
{this.staticUses = const [],
|
||||
this.globalUses = const [],
|
||||
this.dynamicUses = const [],
|
||||
this.instantiatedTypes = const [],
|
||||
this.instantiatedClasses = const [],
|
||||
this.globalClasses = const [],
|
||||
this.otherImpacts = const [],
|
||||
EnumSet<BackendFeature> features = const EnumSet.fixed(0)})
|
||||
: this._features = features;
|
||||
|
||||
Iterable<BackendFeature> get features =>
|
||||
|
@ -738,7 +737,7 @@ class BackendImpacts {
|
|||
BackendImpact(globalClasses: [_commonElements.closureClass]);
|
||||
}
|
||||
|
||||
Map<int, BackendImpact> _genericInstantiation = <int, BackendImpact>{};
|
||||
Map<int, BackendImpact> _genericInstantiation = {};
|
||||
|
||||
BackendImpact getGenericInstantiation(int typeArgumentCount) =>
|
||||
_genericInstantiation[typeArgumentCount] ??= BackendImpact(staticUses: [
|
||||
|
|
|
@ -110,12 +110,12 @@ class BackendUsageBuilderImpl implements BackendUsageBuilder {
|
|||
Setlet<ClassEntity> _globalClassDependencies;
|
||||
|
||||
/// List of methods that the backend may use.
|
||||
final Set<FunctionEntity> _helperFunctionsUsed = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> _helperFunctionsUsed = {};
|
||||
|
||||
/// List of classes that the backend may use.
|
||||
final Set<ClassEntity> _helperClassesUsed = Set<ClassEntity>();
|
||||
final Set<ClassEntity> _helperClassesUsed = {};
|
||||
|
||||
final Set<RuntimeTypeUse> _runtimeTypeUses = Set<RuntimeTypeUse>();
|
||||
final Set<RuntimeTypeUse> _runtimeTypeUses = {};
|
||||
|
||||
bool _needToInitializeIsolateAffinityTag = false;
|
||||
bool _needToInitializeDispatchProperty = false;
|
||||
|
@ -256,18 +256,14 @@ class BackendUsageBuilderImpl implements BackendUsageBuilder {
|
|||
@override
|
||||
void registerGlobalFunctionDependency(FunctionEntity element) {
|
||||
assert(element != null);
|
||||
if (_globalFunctionDependencies == null) {
|
||||
_globalFunctionDependencies = Setlet<FunctionEntity>();
|
||||
}
|
||||
_globalFunctionDependencies ??= Setlet();
|
||||
_globalFunctionDependencies.add(element);
|
||||
}
|
||||
|
||||
@override
|
||||
void registerGlobalClassDependency(ClassEntity element) {
|
||||
assert(element != null);
|
||||
if (_globalClassDependencies == null) {
|
||||
_globalClassDependencies = Setlet<ClassEntity>();
|
||||
}
|
||||
_globalClassDependencies ??= Setlet();
|
||||
_globalClassDependencies.add(element);
|
||||
}
|
||||
|
||||
|
@ -434,11 +430,11 @@ class BackendUsageImpl implements BackendUsage {
|
|||
|
||||
@override
|
||||
Iterable<FunctionEntity> get globalFunctionDependencies =>
|
||||
_globalFunctionDependencies ?? const <FunctionEntity>[];
|
||||
_globalFunctionDependencies ?? const [];
|
||||
|
||||
@override
|
||||
Iterable<ClassEntity> get globalClassDependencies =>
|
||||
_globalClassDependencies ?? const <ClassEntity>[];
|
||||
_globalClassDependencies ?? const [];
|
||||
|
||||
Iterable<FunctionEntity> get helperFunctionsUsed => _helperFunctionsUsed;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class CheckedModeHelpers {
|
|||
CheckedModeHelpers();
|
||||
|
||||
/// All the checked mode helpers.
|
||||
static const List<CheckedModeHelper> helpers = <CheckedModeHelper>[
|
||||
static const List<CheckedModeHelper> helpers = [
|
||||
CheckedModeHelper('boolConversionCheck'),
|
||||
];
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ class ConstantEmitter extends ModularConstantEmitter {
|
|||
classElement, "Compiler encoutered unexpected set class $className");
|
||||
}
|
||||
|
||||
List<jsAst.Expression> arguments = <jsAst.Expression>[
|
||||
List<jsAst.Expression> arguments = [
|
||||
_constantReferenceGenerator(constant.entries),
|
||||
];
|
||||
|
||||
|
@ -281,7 +281,7 @@ class ConstantEmitter extends ModularConstantEmitter {
|
|||
jsAst.Expression visitMap(constant_system.JavaScriptMapConstant constant,
|
||||
[_]) {
|
||||
jsAst.Expression jsMap() {
|
||||
List<jsAst.Property> properties = <jsAst.Property>[];
|
||||
List<jsAst.Property> properties = [];
|
||||
for (int i = 0; i < constant.length; i++) {
|
||||
StringConstantValue key = constant.keys[i];
|
||||
if (key.stringValue ==
|
||||
|
@ -299,7 +299,7 @@ class ConstantEmitter extends ModularConstantEmitter {
|
|||
}
|
||||
|
||||
jsAst.Expression jsGeneralMap() {
|
||||
List<jsAst.Expression> data = <jsAst.Expression>[];
|
||||
List<jsAst.Expression> data = [];
|
||||
for (int i = 0; i < constant.keys.length; i++) {
|
||||
jsAst.Expression keyExpression =
|
||||
_constantReferenceGenerator(constant.keys[i]);
|
||||
|
@ -314,7 +314,7 @@ class ConstantEmitter extends ModularConstantEmitter {
|
|||
ClassEntity classElement = constant.type.element;
|
||||
String className = classElement.name;
|
||||
|
||||
List<jsAst.Expression> arguments = <jsAst.Expression>[];
|
||||
List<jsAst.Expression> arguments = [];
|
||||
|
||||
// The arguments of the JavaScript constructor for any given Dart class
|
||||
// are in the same order as the members of the class element.
|
||||
|
@ -396,7 +396,7 @@ class ConstantEmitter extends ModularConstantEmitter {
|
|||
}
|
||||
jsAst.Expression constructor =
|
||||
_emitter.constructorAccess(constant.type.element);
|
||||
List<jsAst.Expression> fields = <jsAst.Expression>[];
|
||||
List<jsAst.Expression> fields = [];
|
||||
_elementEnvironment.forEachInstanceField(element, (_, FieldEntity field) {
|
||||
FieldAnalysisData fieldData = _fieldAnalysis.getFieldData(field);
|
||||
if (fieldData.isElided) return;
|
||||
|
@ -415,7 +415,7 @@ class ConstantEmitter extends ModularConstantEmitter {
|
|||
[_]) {
|
||||
ClassEntity cls =
|
||||
_commonElements.getInstantiationClass(constant.typeArguments.length);
|
||||
List<jsAst.Expression> fields = <jsAst.Expression>[
|
||||
List<jsAst.Expression> fields = [
|
||||
_constantReferenceGenerator(constant.function)
|
||||
];
|
||||
fields.add(_reifiedTypeNewRti(
|
||||
|
|
|
@ -158,10 +158,10 @@ class CustomElementsAnalysisJoin {
|
|||
|
||||
// Classes that are candidates for needing constructors. Classes are moved to
|
||||
// [activeClasses] when we know they need constructors.
|
||||
final Set<ClassEntity> instantiatedClasses = Set<ClassEntity>();
|
||||
final Set<ClassEntity> instantiatedClasses = {};
|
||||
|
||||
// Classes explicitly named.
|
||||
final Set<ClassEntity> selectedClasses = Set<ClassEntity>();
|
||||
final Set<ClassEntity> selectedClasses = {};
|
||||
|
||||
// True if we must conservatively include all extension classes.
|
||||
bool allClassesSelected = false;
|
||||
|
@ -170,7 +170,7 @@ class CustomElementsAnalysisJoin {
|
|||
bool demanded = false;
|
||||
|
||||
// ClassesOutput: classes requiring metadata.
|
||||
final Set<ClassEntity> activeClasses = Set<ClassEntity>();
|
||||
final Set<ClassEntity> activeClasses = {};
|
||||
|
||||
CustomElementsAnalysisJoin(
|
||||
this._elementEnvironment, this._commonElements, this._nativeData,
|
||||
|
@ -217,7 +217,7 @@ class CustomElementsAnalysisJoin {
|
|||
}
|
||||
|
||||
List<ConstructorEntity> computeEscapingConstructors(ClassEntity cls) {
|
||||
List<ConstructorEntity> result = <ConstructorEntity>[];
|
||||
List<ConstructorEntity> result = [];
|
||||
// Only classes that extend native classes have constructors in the table.
|
||||
// We could refine this to classes that extend Element, but that would break
|
||||
// the tests and there is no sane reason to subclass other native classes.
|
||||
|
|
|
@ -32,7 +32,7 @@ import '../util/util.dart' show Setlet;
|
|||
/// [Enqueuer] which is specific to code generation.
|
||||
class CodegenEnqueuer extends EnqueuerImpl {
|
||||
final String name;
|
||||
Set<ClassEntity> _recentClasses = Setlet<ClassEntity>();
|
||||
Set<ClassEntity> _recentClasses = Setlet();
|
||||
bool _recentConstants = false;
|
||||
final CodegenWorldBuilderImpl _worldBuilder;
|
||||
final WorkItemBuilder _workItemBuilder;
|
||||
|
@ -50,7 +50,7 @@ class CodegenEnqueuer extends EnqueuerImpl {
|
|||
final Queue<WorkItem> _queue = Queue<WorkItem>();
|
||||
|
||||
/// All declaration elements that have been processed by codegen.
|
||||
final Set<MemberEntity> _processedEntities = Set<MemberEntity>();
|
||||
final Set<MemberEntity> _processedEntities = {};
|
||||
|
||||
// If not `null` this is called when the queue has been emptied. It allows for
|
||||
// applying additional impacts before re-emptying the queue.
|
||||
|
|
|
@ -205,17 +205,15 @@ class InferredDataImpl implements InferredData {
|
|||
}
|
||||
|
||||
class InferredDataBuilderImpl implements InferredDataBuilder {
|
||||
final Set<MemberEntity> _functionsCalledInLoop = Set<MemberEntity>();
|
||||
Map<MemberEntity, SideEffectsBuilder> _sideEffectsBuilders =
|
||||
<MemberEntity, SideEffectsBuilder>{};
|
||||
final Set<FunctionEntity> prematureSideEffectAccesses = Set<FunctionEntity>();
|
||||
final Set<MemberEntity> _functionsCalledInLoop = {};
|
||||
Map<MemberEntity, SideEffectsBuilder> _sideEffectsBuilders = {};
|
||||
final Set<FunctionEntity> prematureSideEffectAccesses = {};
|
||||
|
||||
final Set<FunctionEntity> _sideEffectsFreeElements = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> _sideEffectsFreeElements = {};
|
||||
|
||||
final Set<FunctionEntity> _elementsThatCannotThrow = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> _elementsThatCannotThrow = {};
|
||||
|
||||
final Set<FunctionEntity> _functionsThatMightBePassedToApply =
|
||||
Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> _functionsThatMightBePassedToApply = {};
|
||||
|
||||
InferredDataBuilderImpl(AnnotationsData annotationsData) {
|
||||
annotationsData.forEachNoThrows(registerCannotThrow);
|
||||
|
@ -239,8 +237,7 @@ class InferredDataBuilderImpl implements InferredDataBuilder {
|
|||
InferredData close(JClosedWorld closedWorld) {
|
||||
assert(_sideEffectsBuilders != null,
|
||||
"Inferred data has already been computed.");
|
||||
Map<FunctionEntity, SideEffects> _sideEffects =
|
||||
<FunctionEntity, SideEffects>{};
|
||||
Map<FunctionEntity, SideEffects> _sideEffects = {};
|
||||
Iterable<SideEffectsBuilder> sideEffectsBuilders =
|
||||
_sideEffectsBuilders.values;
|
||||
emptyWorkList(sideEffectsBuilders);
|
||||
|
@ -260,8 +257,8 @@ class InferredDataBuilderImpl implements InferredDataBuilder {
|
|||
|
||||
static void emptyWorkList(Iterable<SideEffectsBuilder> sideEffectsBuilders) {
|
||||
// TODO(johnniwinther): Optimize this algorithm.
|
||||
Queue<SideEffectsBuilder> queue = Queue<SideEffectsBuilder>();
|
||||
Set<SideEffectsBuilder> inQueue = Set<SideEffectsBuilder>();
|
||||
Queue<SideEffectsBuilder> queue = Queue();
|
||||
Set<SideEffectsBuilder> inQueue = {};
|
||||
|
||||
for (SideEffectsBuilder builder in sideEffectsBuilders) {
|
||||
queue.addLast(builder);
|
||||
|
|
|
@ -97,13 +97,11 @@ class InterceptorDataImpl implements InterceptorData {
|
|||
///
|
||||
/// These members must be invoked with a correct explicit receiver even when
|
||||
/// the receiver is not an intercepted class.
|
||||
final Map<String, Set<MemberEntity>> _interceptedMixinElements =
|
||||
Map<String, Set<MemberEntity>>();
|
||||
final Map<String, Set<MemberEntity>> _interceptedMixinElements = {};
|
||||
|
||||
final Map<String, Set<ClassEntity>> _interceptedClassesCache =
|
||||
Map<String, Set<ClassEntity>>();
|
||||
final Map<String, Set<ClassEntity>> _interceptedClassesCache = {};
|
||||
|
||||
final Set<ClassEntity> _noClasses = Set<ClassEntity>();
|
||||
final Set<ClassEntity> _noClasses = {};
|
||||
|
||||
InterceptorDataImpl(
|
||||
this._nativeData,
|
||||
|
@ -220,7 +218,7 @@ class InterceptorDataImpl implements InterceptorData {
|
|||
return _interceptedClassesCache.putIfAbsent(name, () {
|
||||
// Populate the cache by running through all the elements and
|
||||
// determine if the given selector applies to them.
|
||||
Set<ClassEntity> result = Set<ClassEntity>();
|
||||
Set<ClassEntity> result = {};
|
||||
for (MemberEntity element in intercepted) {
|
||||
ClassEntity classElement = element.enclosingClass;
|
||||
if (_isCompileTimeOnlyClass(classElement)) continue;
|
||||
|
@ -246,7 +244,7 @@ class InterceptorDataImpl implements InterceptorData {
|
|||
closedWorld.classHierarchy.forEachStrictSubclassOf(use,
|
||||
(ClassEntity subclass) {
|
||||
if (_nativeData.isNativeOrExtendsNative(subclass)) {
|
||||
if (result == null) result = Set<ClassEntity>();
|
||||
if (result == null) result = {};
|
||||
result.add(subclass);
|
||||
}
|
||||
return IterationStep.CONTINUE;
|
||||
|
@ -290,17 +288,15 @@ class InterceptorDataBuilderImpl implements InterceptorDataBuilder {
|
|||
/// The members of instantiated interceptor classes: maps a member name to the
|
||||
/// list of members that have that name. This map is used by the codegen to
|
||||
/// know whether a send must be intercepted or not.
|
||||
final Map<String, Set<MemberEntity>> _interceptedElements =
|
||||
<String, Set<MemberEntity>>{};
|
||||
final Map<String, Set<MemberEntity>> _interceptedElements = {};
|
||||
|
||||
/// Set of classes whose methods are intercepted.
|
||||
final Set<ClassEntity> _interceptedClasses = Set<ClassEntity>();
|
||||
final Set<ClassEntity> _interceptedClasses = {};
|
||||
|
||||
/// Set of classes used as mixins on intercepted (native and primitive)
|
||||
/// classes. Methods on these classes might also be mixed in to regular Dart
|
||||
/// (unintercepted) classes.
|
||||
final Set<ClassEntity> _classesMixedIntoInterceptedClasses =
|
||||
Set<ClassEntity>();
|
||||
final Set<ClassEntity> _classesMixedIntoInterceptedClasses = {};
|
||||
|
||||
InterceptorDataBuilderImpl(
|
||||
this._nativeData, this._elementEnvironment, this._commonElements);
|
||||
|
@ -322,8 +318,7 @@ class InterceptorDataBuilderImpl implements InterceptorDataBuilder {
|
|||
if (member.name == Identifiers.call) return;
|
||||
// All methods on [Object] are shadowed by [Interceptor].
|
||||
if (cls == _commonElements.objectClass) return;
|
||||
Set<MemberEntity> set =
|
||||
_interceptedElements[member.name] ??= Set<MemberEntity>();
|
||||
Set<MemberEntity> set = _interceptedElements[member.name] ??= {};
|
||||
set.add(member);
|
||||
});
|
||||
|
||||
|
@ -340,8 +335,7 @@ class InterceptorDataBuilderImpl implements InterceptorDataBuilder {
|
|||
(ClassEntity cls, MemberEntity member) {
|
||||
// All methods on [Object] are shadowed by [Interceptor].
|
||||
if (cls == _commonElements.objectClass) return;
|
||||
Set<MemberEntity> set =
|
||||
_interceptedElements[member.name] ??= Set<MemberEntity>();
|
||||
Set<MemberEntity> set = _interceptedElements[member.name] ??= {};
|
||||
set.add(member);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import 'native_data.dart';
|
|||
jsAst.Statement buildJsInteropBootstrap(
|
||||
CodegenWorld codegenWorld, NativeBasicData nativeBasicData, Namer namer) {
|
||||
if (!nativeBasicData.isJsInteropUsed) return null;
|
||||
List<jsAst.Statement> statements = <jsAst.Statement>[];
|
||||
List<jsAst.Statement> statements = [];
|
||||
codegenWorld.forEachInvokedName(
|
||||
(String name, Map<Selector, SelectorConstraints> selectors) {
|
||||
selectors.forEach((Selector selector, SelectorConstraints constraints) {
|
||||
|
|
|
@ -48,7 +48,7 @@ class MinifyNamer extends Namer
|
|||
// variables) because they clash with names from the DOM. However, it is
|
||||
// OK to use them as fields, as we only access fields directly if we know
|
||||
// the receiver type.
|
||||
static const List<String> _reservedNativeProperties = <String>[
|
||||
static const List<String> _reservedNativeProperties = [
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'r', 'x', 'y', 'z', 'Q',
|
||||
// 2-letter:
|
||||
'ch', 'cx', 'cy', 'db', 'dx', 'dy', 'fr', 'fx', 'fy', 'go', 'id', 'k1',
|
||||
|
@ -95,7 +95,7 @@ class MinifyNamer extends Namer
|
|||
// individually per program, but that would mean that the output of the
|
||||
// minifier was less stable from version to version of the program being
|
||||
// minified.
|
||||
_populateSuggestedNames(instanceScope, const <String>[
|
||||
_populateSuggestedNames(instanceScope, const [
|
||||
r'$add',
|
||||
r'add$1',
|
||||
r'$and',
|
||||
|
@ -136,7 +136,7 @@ class MinifyNamer extends Namer
|
|||
r'toString$0'
|
||||
]);
|
||||
|
||||
_populateSuggestedNames(globalScope, const <String>[
|
||||
_populateSuggestedNames(globalScope, const [
|
||||
r'Object',
|
||||
'wrapException',
|
||||
r'$eq',
|
||||
|
@ -208,7 +208,7 @@ class MinifyNamer extends Namer
|
|||
for (int n = 1; n <= 3; n++) {
|
||||
int h = hash;
|
||||
while (h > 10) {
|
||||
List<int> codes = <int>[_letterNumber(h)];
|
||||
List<int> codes = [_letterNumber(h)];
|
||||
int h2 = h ~/ ALPHABET_CHARACTERS;
|
||||
for (int i = 1; i < n; i++) {
|
||||
codes.add(_alphaNumericNumber(h2));
|
||||
|
@ -251,7 +251,7 @@ class MinifyNamer extends Namer
|
|||
|
||||
/// Remember bad hashes to avoid using a the same character with long numbers
|
||||
/// for frequent hashes. For example, `closure` is a very common name.
|
||||
Map<int, int> _badNames = Map<int, int>();
|
||||
Map<int, int> _badNames = {};
|
||||
|
||||
/// If we can't find a hash based name in the three-letter space, then base
|
||||
/// the name on a letter and a counter.
|
||||
|
@ -360,8 +360,7 @@ class _ConstructorBodyNamingScope {
|
|||
}
|
||||
|
||||
abstract class _MinifyConstructorBodyNamer implements Namer {
|
||||
Map<ClassEntity, _ConstructorBodyNamingScope> _constructorBodyScopes =
|
||||
Map<ClassEntity, _ConstructorBodyNamingScope>();
|
||||
Map<ClassEntity, _ConstructorBodyNamingScope> _constructorBodyScopes = {};
|
||||
|
||||
@override
|
||||
jsAst.Name constructorBodyName(ConstructorBodyEntity method) {
|
||||
|
|
|
@ -135,7 +135,7 @@ part 'namer_names.dart';
|
|||
/// For local variables, the [Namer] only provides *proposed names*. These names
|
||||
/// must be disambiguated elsewhere.
|
||||
class Namer extends ModularNamer {
|
||||
static const List<String> javaScriptKeywords = <String>[
|
||||
static const List<String> javaScriptKeywords = [
|
||||
// ES5 7.6.1.1 Keywords.
|
||||
'break',
|
||||
'do',
|
||||
|
@ -238,7 +238,7 @@ class Namer extends ModularNamer {
|
|||
// Other words to avoid due to non-standard keyword-like behavior.
|
||||
];
|
||||
|
||||
static const List<String> reservedPropertySymbols = <String>[
|
||||
static const List<String> reservedPropertySymbols = [
|
||||
"__proto__", "prototype", "constructor", "call",
|
||||
// "use strict" disallows the use of "arguments" and "eval" as
|
||||
// variable names or property names. See ECMA-262, Edition 5.1,
|
||||
|
@ -304,7 +304,7 @@ class Namer extends ModularNamer {
|
|||
|
||||
/// Symbols that we might be using in our JS snippets. Some of the symbols in
|
||||
/// these sections are in [reservedGlobalUpperCaseSymbols] above.
|
||||
static const List<String> reservedGlobalSymbols = <String>[
|
||||
static const List<String> reservedGlobalSymbols = [
|
||||
// Section references are from Ecma-262
|
||||
// (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf)
|
||||
|
||||
|
@ -394,7 +394,7 @@ class Namer extends ModularNamer {
|
|||
|
||||
// TODO(joshualitt): Stop reserving these names after local naming is updated
|
||||
// to use frequencies.
|
||||
static const List<String> reservedGlobalObjectNames = <String>[
|
||||
static const List<String> reservedGlobalObjectNames = [
|
||||
"A",
|
||||
"B",
|
||||
"C", // Global object for *C*onstants.
|
||||
|
@ -423,7 +423,7 @@ class Namer extends ModularNamer {
|
|||
"Z",
|
||||
];
|
||||
|
||||
static const List<String> reservedGlobalHelperFunctions = <String>[
|
||||
static const List<String> reservedGlobalHelperFunctions = [
|
||||
"init",
|
||||
];
|
||||
|
||||
|
@ -1606,7 +1606,7 @@ class ConstantNamingVisitor implements ConstantValueVisitor {
|
|||
|
||||
String root = null; // First word, usually a type name.
|
||||
bool failed = false; // Failed to generate something pretty.
|
||||
List<String> fragments = <String>[];
|
||||
List<String> fragments = [];
|
||||
int length = 0;
|
||||
|
||||
ConstantNamingVisitor(this._namer, this._closedWorld, this._hasher);
|
||||
|
|
|
@ -152,7 +152,7 @@ class CompoundName extends _NamerName implements jsAst.AstContainer {
|
|||
|
||||
CompoundName(this._parts);
|
||||
|
||||
CompoundName.from(List<jsAst.Name> parts) : this(<_NamerName>[...parts]);
|
||||
CompoundName.from(List<jsAst.Name> parts) : this([...parts]);
|
||||
|
||||
@override
|
||||
bool get isFinalized => _parts.every((name) => name.isFinalized);
|
||||
|
|
|
@ -186,20 +186,19 @@ class NativeBasicDataBuilderImpl implements NativeBasicDataBuilder {
|
|||
|
||||
/// Tag info for native JavaScript classes names. See
|
||||
/// [setNativeClassTagInfo].
|
||||
Map<ClassEntity, NativeClassTag> nativeClassTagInfo =
|
||||
<ClassEntity, NativeClassTag>{};
|
||||
Map<ClassEntity, NativeClassTag> nativeClassTagInfo = {};
|
||||
|
||||
/// The JavaScript libraries implemented via typed JavaScript interop.
|
||||
Map<LibraryEntity, String> jsInteropLibraries = <LibraryEntity, String>{};
|
||||
Map<LibraryEntity, String> jsInteropLibraries = {};
|
||||
|
||||
/// The JavaScript classes implemented via typed JavaScript interop.
|
||||
Map<ClassEntity, String> jsInteropClasses = <ClassEntity, String>{};
|
||||
Map<ClassEntity, String> jsInteropClasses = {};
|
||||
|
||||
/// JavaScript interop classes annotated with `@anonymous`
|
||||
Set<ClassEntity> anonymousJsInteropClasses = Set<ClassEntity>();
|
||||
Set<ClassEntity> anonymousJsInteropClasses = {};
|
||||
|
||||
/// The JavaScript members implemented via typed JavaScript interop.
|
||||
Map<MemberEntity, String> jsInteropMembers = <MemberEntity, String>{};
|
||||
Map<MemberEntity, String> jsInteropMembers = {};
|
||||
|
||||
@override
|
||||
void setNativeClassTagInfo(ClassEntity cls, String tagText) {
|
||||
|
@ -477,19 +476,16 @@ class NativeDataBuilderImpl implements NativeDataBuilder {
|
|||
final NativeBasicDataImpl _nativeBasicData;
|
||||
|
||||
/// The JavaScript names for native JavaScript elements implemented.
|
||||
Map<MemberEntity, String> nativeMemberName = <MemberEntity, String>{};
|
||||
Map<MemberEntity, String> nativeMemberName = {};
|
||||
|
||||
/// Cache for [NativeBehavior]s for calling native methods.
|
||||
Map<FunctionEntity, NativeBehavior> nativeMethodBehavior =
|
||||
<FunctionEntity, NativeBehavior>{};
|
||||
Map<FunctionEntity, NativeBehavior> nativeMethodBehavior = {};
|
||||
|
||||
/// Cache for [NativeBehavior]s for reading from native fields.
|
||||
Map<MemberEntity, NativeBehavior> nativeFieldLoadBehavior =
|
||||
<FieldEntity, NativeBehavior>{};
|
||||
Map<MemberEntity, NativeBehavior> nativeFieldLoadBehavior = {};
|
||||
|
||||
/// Cache for [NativeBehavior]s for writing to native fields.
|
||||
Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior =
|
||||
<FieldEntity, NativeBehavior>{};
|
||||
Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior = {};
|
||||
|
||||
NativeDataBuilderImpl(this._nativeBasicData);
|
||||
|
||||
|
|
|
@ -67,25 +67,25 @@ abstract class NoSuchMethodRegistry {
|
|||
|
||||
class NoSuchMethodRegistryImpl implements NoSuchMethodRegistry {
|
||||
/// The implementations that fall into category A, described above.
|
||||
final Set<FunctionEntity> defaultImpls = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> defaultImpls = {};
|
||||
|
||||
/// The implementations that fall into category B, described above.
|
||||
final Set<FunctionEntity> throwingImpls = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> throwingImpls = {};
|
||||
|
||||
/// The implementations that fall into category C, described above.
|
||||
// TODO(johnniwinther): Remove this category when Dart 1 is no longer
|
||||
// supported.
|
||||
final Set<FunctionEntity> notApplicableImpls = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> notApplicableImpls = {};
|
||||
|
||||
/// The implementations that fall into category D, described above.
|
||||
final Set<FunctionEntity> otherImpls = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> otherImpls = {};
|
||||
|
||||
/// The implementations that have not yet been categorized.
|
||||
final Set<FunctionEntity> _uncategorizedImpls = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> _uncategorizedImpls = {};
|
||||
|
||||
/// The implementations that a forwarding syntax as defined by
|
||||
/// [NoSuchMethodResolver.hasForwardSyntax].
|
||||
final Set<FunctionEntity> forwardingSyntaxImpls = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> forwardingSyntaxImpls = {};
|
||||
|
||||
final CommonElements _commonElements;
|
||||
final NoSuchMethodResolver _resolver;
|
||||
|
@ -210,10 +210,10 @@ class NoSuchMethodDataImpl implements NoSuchMethodData {
|
|||
final Set<FunctionEntity> otherImpls;
|
||||
|
||||
/// The implementations that fall into category D1
|
||||
final Set<FunctionEntity> complexNoReturnImpls = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> complexNoReturnImpls = {};
|
||||
|
||||
/// The implementations that fall into category D2
|
||||
final Set<FunctionEntity> complexReturningImpls = Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> complexReturningImpls = {};
|
||||
|
||||
final Set<FunctionEntity> forwardingSyntaxImpls;
|
||||
|
||||
|
|
|
@ -265,10 +265,11 @@ class ResolutionEnqueuerListener extends EnqueuerListener {
|
|||
FunctionType functionType =
|
||||
_elementEnvironment.getFunctionType(function);
|
||||
|
||||
var allParameterTypes = <DartType>[]
|
||||
..addAll(functionType.parameterTypes)
|
||||
..addAll(functionType.optionalParameterTypes)
|
||||
..addAll(functionType.namedParameterTypes);
|
||||
var allParameterTypes = <DartType>[
|
||||
...functionType.parameterTypes,
|
||||
...functionType.optionalParameterTypes,
|
||||
...functionType.namedParameterTypes
|
||||
];
|
||||
for (var type in allParameterTypes) {
|
||||
if (type.withoutNullability is FunctionType) {
|
||||
var closureConverter = _commonElements.closureConverter;
|
||||
|
@ -454,7 +455,7 @@ class ResolutionEnqueuerListener extends EnqueuerListener {
|
|||
void _registerCheckedModeHelpers(WorldImpactBuilder impactBuilder) {
|
||||
// We register all the _commonElements in the resolution queue.
|
||||
// TODO(13155): Find a way to register fewer _commonElements.
|
||||
List<FunctionEntity> staticUses = <FunctionEntity>[];
|
||||
List<FunctionEntity> staticUses = [];
|
||||
for (CheckedModeHelper helper in CheckedModeHelpers.helpers) {
|
||||
staticUses.add(helper.getStaticUse(_commonElements).element);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class TrivialRuntimeTypesChecksBuilder implements RuntimeTypesChecksBuilder {
|
|||
CodegenWorld codegenWorld, CompilerOptions options) {
|
||||
rtiChecksBuilderClosed = true;
|
||||
|
||||
Map<ClassEntity, ClassUse> classUseMap = <ClassEntity, ClassUse>{};
|
||||
Map<ClassEntity, ClassUse> classUseMap = {};
|
||||
for (ClassEntity cls in _closedWorld.classHierarchy
|
||||
.getClassSet(_closedWorld.commonElements.objectClass)
|
||||
.subtypes()) {
|
||||
|
@ -109,7 +109,7 @@ class TrivialRuntimeTypesChecksBuilder implements RuntimeTypesChecksBuilder {
|
|||
|
||||
Set<FunctionType> computeCheckedFunctions(
|
||||
CodegenWorldBuilder codegenWorldBuilder, Set<DartType> implicitIsChecks) {
|
||||
return Set<FunctionType>();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ abstract class RuntimeTypesSubstitutionsMixin
|
|||
// arguments and record all combination where the element of a checked
|
||||
// argument is a superclass of the element of an instantiated type.
|
||||
TypeCheckMapping result = TypeCheckMapping();
|
||||
Set<ClassEntity> handled = Set<ClassEntity>();
|
||||
Set<ClassEntity> handled = {};
|
||||
|
||||
// Empty usage object for classes with no direct rti usage.
|
||||
final ClassUse emptyUse = ClassUse();
|
||||
|
@ -182,7 +182,7 @@ abstract class RuntimeTypesSubstitutionsMixin
|
|||
//
|
||||
// This set reflects the emitted class hierarchy and therefore uses
|
||||
// `getEffectiveMixinClass` to find the inherited mixins.
|
||||
Set<ClassEntity> inheritedClasses = Set<ClassEntity>();
|
||||
Set<ClassEntity> inheritedClasses = {};
|
||||
ClassEntity other = cls;
|
||||
while (other != null) {
|
||||
inheritedClasses.add(other);
|
||||
|
@ -354,7 +354,7 @@ abstract class RuntimeTypesSubstitutionsMixin
|
|||
|
||||
@override
|
||||
Set<ClassEntity> getClassesUsedInSubstitutions(TypeChecks checks) {
|
||||
Set<ClassEntity> instantiated = Set<ClassEntity>();
|
||||
Set<ClassEntity> instantiated = {};
|
||||
ArgumentCollector collector = ArgumentCollector();
|
||||
for (ClassEntity target in checks.classes) {
|
||||
ClassChecks classChecks = checks[target];
|
||||
|
@ -474,12 +474,11 @@ class _RuntimeTypesChecks implements RuntimeTypesChecks {
|
|||
|
||||
@override
|
||||
Iterable<ClassEntity> get requiredClasses {
|
||||
Set<ClassEntity> required = Set<ClassEntity>();
|
||||
required.addAll(_typeArguments);
|
||||
required.addAll(_typeLiterals);
|
||||
required
|
||||
.addAll(_substitutions.getClassesUsedInSubstitutions(requiredChecks));
|
||||
return required;
|
||||
return {
|
||||
..._typeArguments,
|
||||
..._typeLiterals,
|
||||
..._substitutions.getClassesUsedInSubstitutions(requiredChecks)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,9 +489,9 @@ class RuntimeTypesImpl
|
|||
final JClosedWorld _closedWorld;
|
||||
|
||||
// The set of type arguments tested against type variable bounds.
|
||||
final Set<DartType> checkedTypeArguments = Set<DartType>();
|
||||
final Set<DartType> checkedTypeArguments = {};
|
||||
// The set of tested type variable bounds.
|
||||
final Set<DartType> checkedBounds = Set<DartType>();
|
||||
final Set<DartType> checkedBounds = {};
|
||||
|
||||
TypeChecks cachedRequiredChecks;
|
||||
|
||||
|
@ -513,8 +512,7 @@ class RuntimeTypesImpl
|
|||
|
||||
Map<ClassEntity, ClassUse> classUseMapForTesting;
|
||||
|
||||
final Set<GenericInstantiation> _genericInstantiations =
|
||||
Set<GenericInstantiation>();
|
||||
final Set<GenericInstantiation> _genericInstantiations = {};
|
||||
|
||||
@override
|
||||
void registerTypeVariableBoundsSubtypeCheck(
|
||||
|
@ -537,14 +535,14 @@ class RuntimeTypesImpl
|
|||
Set<DartType> explicitIsChecks = typeVariableTests.explicitIsChecks;
|
||||
Set<DartType> implicitIsChecks = typeVariableTests.implicitIsChecks;
|
||||
|
||||
Map<ClassEntity, ClassUse> classUseMap = <ClassEntity, ClassUse>{};
|
||||
Map<ClassEntity, ClassUse> classUseMap = {};
|
||||
if (retainDataForTesting) {
|
||||
classUseMapForTesting = classUseMap;
|
||||
}
|
||||
|
||||
Set<FunctionType> checkedFunctionTypes = Set<FunctionType>();
|
||||
Set<ClassEntity> typeLiterals = Set<ClassEntity>();
|
||||
Set<ClassEntity> typeArguments = Set<ClassEntity>();
|
||||
Set<FunctionType> checkedFunctionTypes = {};
|
||||
Set<ClassEntity> typeLiterals = {};
|
||||
Set<ClassEntity> typeArguments = {};
|
||||
|
||||
// The [liveTypeVisitor] is used to register class use in the type of
|
||||
// instantiated objects like `new T` and the function types of
|
||||
|
@ -711,7 +709,7 @@ class RuntimeTypesImpl
|
|||
|
||||
// Collect classes that are 'live' either through instantiation or use in
|
||||
// type arguments.
|
||||
List<ClassEntity> liveClasses = <ClassEntity>[];
|
||||
List<ClassEntity> liveClasses = [];
|
||||
classUseMap.forEach((ClassEntity cls, ClassUse classUse) {
|
||||
if (classUse.isLive) {
|
||||
liveClasses.add(cls);
|
||||
|
@ -774,7 +772,7 @@ ClassFunctionType _computeFunctionType(
|
|||
}
|
||||
|
||||
class TypeCheckMapping implements TypeChecks {
|
||||
final Map<ClassEntity, ClassChecks> map = Map<ClassEntity, ClassChecks>();
|
||||
final Map<ClassEntity, ClassChecks> map = {};
|
||||
|
||||
@override
|
||||
ClassChecks operator [](ClassEntity element) {
|
||||
|
@ -802,7 +800,7 @@ class TypeCheckMapping implements TypeChecks {
|
|||
}
|
||||
|
||||
class ArgumentCollector extends DartTypeVisitor<void, void> {
|
||||
final Set<ClassEntity> classes = Set<ClassEntity>();
|
||||
final Set<ClassEntity> classes = {};
|
||||
|
||||
void addClass(ClassEntity cls) {
|
||||
classes.add(cls);
|
||||
|
@ -875,8 +873,7 @@ enum TypeVisitorState {
|
|||
}
|
||||
|
||||
class TypeVisitor extends DartTypeVisitor<void, TypeVisitorState> {
|
||||
Set<FunctionTypeVariable> _visitedFunctionTypeVariables =
|
||||
Set<FunctionTypeVariable>();
|
||||
Set<FunctionTypeVariable> _visitedFunctionTypeVariables = {};
|
||||
|
||||
final void Function(ClassEntity entity, {TypeVisitorState state}) onClass;
|
||||
final void Function(TypeVariableEntity entity, {TypeVisitorState state})
|
||||
|
@ -1061,7 +1058,7 @@ class ClassUse {
|
|||
|
||||
@override
|
||||
String toString() {
|
||||
List<String> properties = <String>[];
|
||||
List<String> properties = [];
|
||||
if (instance) {
|
||||
properties.add('instance');
|
||||
}
|
||||
|
|
|
@ -47,10 +47,10 @@ class ClassChecks {
|
|||
|
||||
final ClassFunctionType functionType;
|
||||
|
||||
ClassChecks(this.functionType) : _map = <ClassEntity, TypeCheck>{};
|
||||
ClassChecks(this.functionType) : _map = {};
|
||||
|
||||
const ClassChecks.empty()
|
||||
: _map = const <ClassEntity, TypeCheck>{},
|
||||
: _map = const {},
|
||||
functionType = null;
|
||||
|
||||
void add(TypeCheck check) {
|
||||
|
|
|
@ -27,7 +27,7 @@ abstract class RtiNode {
|
|||
int _testState = 0;
|
||||
int _literalState = 0;
|
||||
|
||||
Iterable<RtiNode> get dependencies => _dependencies ?? const <RtiNode>[];
|
||||
Iterable<RtiNode> get dependencies => _dependencies ?? const [];
|
||||
|
||||
bool get hasDirectTest => _testState & 1 != 0;
|
||||
bool get hasIndirectTest => _testState & 2 != 0;
|
||||
|
@ -48,7 +48,7 @@ abstract class RtiNode {
|
|||
// [entity]!
|
||||
return false;
|
||||
}
|
||||
_dependencies ??= Set<RtiNode>();
|
||||
_dependencies ??= {};
|
||||
return _dependencies.add(node);
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ class TypeVariableTests {
|
|||
final Set<DartType> explicitIsChecks;
|
||||
|
||||
/// All implicit is-tests.
|
||||
final Set<DartType> implicitIsChecks = Set<DartType>();
|
||||
final Set<DartType> implicitIsChecks = {};
|
||||
|
||||
TypeVariableTests(this._elementEnvironment, this._commonElements, this._world,
|
||||
this._genericInstantiations,
|
||||
|
@ -316,7 +316,7 @@ class TypeVariableTests {
|
|||
} else {
|
||||
dependencies = _methods[entity]?.dependencies;
|
||||
}
|
||||
if (dependencies == null) return const <Entity>[];
|
||||
if (dependencies == null) return const [];
|
||||
return dependencies.map((n) => n.entity).toSet();
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ class TypeVariableTests {
|
|||
});
|
||||
|
||||
if (forRtiNeeds) {
|
||||
_appliedSelectorMap = <Selector, Set<Entity>>{};
|
||||
_appliedSelectorMap = {};
|
||||
}
|
||||
|
||||
_world.forEachDynamicTypeArgument(
|
||||
|
@ -1004,12 +1004,11 @@ class TrivialRuntimeTypesNeedBuilder implements RuntimeTypesNeedBuilder {
|
|||
class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
||||
final ElementEnvironment _elementEnvironment;
|
||||
|
||||
final Set<ClassEntity> classesUsingTypeVariableLiterals = Set<ClassEntity>();
|
||||
final Set<ClassEntity> classesUsingTypeVariableLiterals = {};
|
||||
|
||||
final Set<FunctionEntity> methodsUsingTypeVariableLiterals =
|
||||
Set<FunctionEntity>();
|
||||
final Set<FunctionEntity> methodsUsingTypeVariableLiterals = {};
|
||||
|
||||
final Set<Local> localFunctionsUsingTypeVariableLiterals = Set<Local>();
|
||||
final Set<Local> localFunctionsUsingTypeVariableLiterals = {};
|
||||
|
||||
Map<Selector, Set<Entity>> selectorsNeedingTypeArgumentsForTesting;
|
||||
|
||||
|
@ -1019,8 +1018,7 @@ class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
|||
get instantiatedEntitiesNeedingTypeArgumentsForTesting =>
|
||||
_instantiatedEntitiesNeedingTypeArgumentsForTesting ?? const {};
|
||||
|
||||
final Set<GenericInstantiation> _genericInstantiations =
|
||||
Set<GenericInstantiation>();
|
||||
final Set<GenericInstantiation> _genericInstantiations = {};
|
||||
|
||||
TypeVariableTests typeVariableTestsForTesting;
|
||||
|
||||
|
@ -1054,12 +1052,12 @@ class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
|||
closedWorld.commonElements,
|
||||
closedWorld,
|
||||
_genericInstantiations);
|
||||
Set<ClassEntity> classesNeedingTypeArguments = Set<ClassEntity>();
|
||||
Set<FunctionEntity> methodsNeedingSignature = Set<FunctionEntity>();
|
||||
Set<FunctionEntity> methodsNeedingTypeArguments = Set<FunctionEntity>();
|
||||
Set<Local> localFunctionsNeedingSignature = Set<Local>();
|
||||
Set<Local> localFunctionsNeedingTypeArguments = Set<Local>();
|
||||
Set<Entity> processedEntities = Set<Entity>();
|
||||
Set<ClassEntity> classesNeedingTypeArguments = {};
|
||||
Set<FunctionEntity> methodsNeedingSignature = {};
|
||||
Set<FunctionEntity> methodsNeedingTypeArguments = {};
|
||||
Set<Local> localFunctionsNeedingSignature = {};
|
||||
Set<Local> localFunctionsNeedingTypeArguments = {};
|
||||
Set<Entity> processedEntities = {};
|
||||
|
||||
// Find the classes that need type arguments at runtime. Such
|
||||
// classes are:
|
||||
|
@ -1139,14 +1137,14 @@ class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
|||
}
|
||||
});
|
||||
localFunctionsNeedingSignature.add(function);
|
||||
localFunctionsToRemove ??= Set<Local>();
|
||||
localFunctionsToRemove ??= {};
|
||||
localFunctionsToRemove.add(function);
|
||||
}
|
||||
}
|
||||
for (FunctionEntity function in closurizedMembers) {
|
||||
if (checkFunctionType(_elementEnvironment.getFunctionType(function))) {
|
||||
methodsNeedingSignature.add(function);
|
||||
closurizedMembersToRemove ??= Set<FunctionEntity>();
|
||||
closurizedMembersToRemove ??= {};
|
||||
closurizedMembersToRemove.add(function);
|
||||
}
|
||||
}
|
||||
|
@ -1247,7 +1245,7 @@ class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
|||
/// Set to `true` if subclasses of `Function` need runtimeType.
|
||||
bool neededOnFunctions = false;
|
||||
|
||||
Set<ClassEntity> classesDirectlyNeedingRuntimeType = Set<ClassEntity>();
|
||||
Set<ClassEntity> classesDirectlyNeedingRuntimeType = {};
|
||||
|
||||
Iterable<ClassEntity> impliedClasses(DartType type) {
|
||||
type = type.withoutNullability;
|
||||
|
@ -1346,7 +1344,7 @@ class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
|||
.subclassesOf(commonElements.objectClass)
|
||||
.toSet();
|
||||
} else {
|
||||
allClassesNeedingRuntimeType = Set<ClassEntity>();
|
||||
allClassesNeedingRuntimeType = {};
|
||||
// TODO(johnniwinther): Support this operation directly in
|
||||
// [ClosedWorld] using the [ClassSet]s.
|
||||
for (ClassEntity cls in classesDirectlyNeedingRuntimeType) {
|
||||
|
@ -1379,7 +1377,7 @@ class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
Set<Selector> selectorsNeedingTypeArguments = Set<Selector>();
|
||||
Set<Selector> selectorsNeedingTypeArguments = {};
|
||||
typeVariableTests
|
||||
.forEachAppliedSelector((Selector selector, Set<Entity> targets) {
|
||||
for (Entity target in targets) {
|
||||
|
@ -1388,10 +1386,9 @@ class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
|||
localFunctionsNeedingTypeArguments.contains(target)) {
|
||||
selectorsNeedingTypeArguments.add(selector);
|
||||
if (retainDataForTesting) {
|
||||
selectorsNeedingTypeArgumentsForTesting ??=
|
||||
<Selector, Set<Entity>>{};
|
||||
selectorsNeedingTypeArgumentsForTesting ??= {};
|
||||
selectorsNeedingTypeArgumentsForTesting
|
||||
.putIfAbsent(selector, () => Set<Entity>())
|
||||
.putIfAbsent(selector, () => {})
|
||||
.add(target);
|
||||
} else {
|
||||
return;
|
||||
|
@ -1399,7 +1396,7 @@ class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
|
|||
}
|
||||
}
|
||||
});
|
||||
Set<int> instantiationsNeedingTypeArguments = Set<int>();
|
||||
Set<int> instantiationsNeedingTypeArguments = {};
|
||||
typeVariableTests.forEachInstantiatedEntity(
|
||||
(Entity target, Set<GenericInstantiation> instantiations) {
|
||||
if (methodsNeedingTypeArguments.contains(target) ||
|
||||
|
|
Loading…
Reference in a new issue