From 441dca77fd9d2dfde2fb28862a8c0c99720eb8a1 Mon Sep 17 00:00:00 2001 From: Jens Johansen Date: Mon, 24 Jan 2022 14:38:36 +0000 Subject: [PATCH] [CFE][kernel] Use .of instead of .from This CL replaces most usages of `.from` (e.g. `List.from(variable)`) to use `.of` instead. This is done because code like `List foo = new List.from([null])` is valid and gives no warnings or errors. Using `.of` instead will give an error. Also `.of` appears to be slightly faster. Change-Id: I1b4327be228b77e6a3e9faa283f8ce64f0565608 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228642 Reviewed-by: Johnni Winther Reviewed-by: Chloe Stefantsova Commit-Queue: Jens Johansen --- pkg/front_end/lib/src/fasta/combinator.dart | 4 ++-- .../lib/src/fasta/get_dependencies.dart | 2 +- .../lib/src/fasta/incremental_compiler.dart | 6 +++--- .../lib/src/fasta/incremental_serializer.dart | 2 +- .../lib/src/fasta/kernel/body_builder.dart | 19 +++++++++++-------- .../src/fasta/kernel/constant_evaluator.dart | 2 +- .../lib/src/fasta/kernel/forest.dart | 4 ++-- .../fasta/kernel/hierarchy/members_node.dart | 2 +- .../lib/src/fasta/kernel/kernel_target.dart | 2 +- .../fasta/source/source_class_builder.dart | 4 ++-- .../source/source_constructor_builder.dart | 2 +- .../fasta/source/source_library_builder.dart | 2 +- .../lib/src/fasta/source/source_loader.dart | 2 +- .../lib/src/kernel_generator_impl.dart | 2 +- pkg/front_end/tool/generate_ast_coverage.dart | 2 +- pkg/kernel/lib/ast.dart | 10 +++++----- pkg/kernel/lib/binary/ast_from_binary.dart | 2 +- pkg/kernel/lib/class_hierarchy.dart | 4 ++-- pkg/kernel/lib/clone.dart | 2 +- pkg/kernel/lib/src/coverage.dart | 12 ++++++------ pkg/kernel/lib/src/standard_bounds.dart | 2 +- pkg/kernel/lib/target/targets.dart | 2 +- pkg/kernel/lib/util/graph.dart | 2 +- 23 files changed, 48 insertions(+), 45 deletions(-) diff --git a/pkg/front_end/lib/src/fasta/combinator.dart b/pkg/front_end/lib/src/fasta/combinator.dart index 9f07af04655..4ac777ef2b7 100644 --- a/pkg/front_end/lib/src/fasta/combinator.dart +++ b/pkg/front_end/lib/src/fasta/combinator.dart @@ -10,10 +10,10 @@ class CombinatorBuilder { CombinatorBuilder(this.isShow, this.names, int charOffset, Uri fileUri); CombinatorBuilder.show(Iterable names, int charOffset, Uri fileUri) - : this(true, new Set.from(names), charOffset, fileUri); + : this(true, new Set.of(names), charOffset, fileUri); CombinatorBuilder.hide(Iterable names, int charOffset, Uri fileUri) - : this(false, new Set.from(names), charOffset, fileUri); + : this(false, new Set.of(names), charOffset, fileUri); bool get isHide => !isShow; } diff --git a/pkg/front_end/lib/src/fasta/get_dependencies.dart b/pkg/front_end/lib/src/fasta/get_dependencies.dart index 1db1afa2723..284b335a625 100644 --- a/pkg/front_end/lib/src/fasta/get_dependencies.dart +++ b/pkg/front_end/lib/src/fasta/get_dependencies.dart @@ -54,6 +54,6 @@ Future> getDependencies(Uri script, kernelTarget.setEntryPoints([script]); dillTarget.buildOutlines(); await kernelTarget.loader.buildOutlines(); - return new List.from(c.dependencies); + return new List.of(c.dependencies); }); } diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart index 2a1e8b7e05f..8542b6070bb 100644 --- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart +++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart @@ -394,7 +394,7 @@ class IncrementalCompiler implements IncrementalKernelGenerator { // Compute which libraries to output and which (previous) errors/warnings // we have to reissue. In the process do some cleanup too. List compiledLibraries = - new List.from(currentKernelTarget.loader.libraries); + new List.of(currentKernelTarget.loader.libraries); Map uriToSource = componentWithDill!.uriToSource; _experimentalCompilationPostCompilePatchup( experimentalInvalidation, compiledLibraries, uriToSource); @@ -2047,7 +2047,7 @@ class IncrementalCompiler implements IncrementalKernelGenerator { IncrementalKernelTarget? lastGoodKernelTarget = this._lastGoodKernelTarget; if (lastGoodKernelTarget != null) { Set uris = - new Set.from(lastGoodKernelTarget.loader.libraryImportUris); + new Set.of(lastGoodKernelTarget.loader.libraryImportUris); uris.removeAll(_dillLoadedData!.loader.libraryImportUris); if (_previousSourceBuilders != null) { for (Library library in _previousSourceBuilders!) { @@ -2578,7 +2578,7 @@ class _ComponentProblems { // Save any new component-problems. _addProblemsAsJson(componentWithDill.problemsAsJson); - return new List.from(issuedProblems); + return new List.of(issuedProblems); } void saveComponentProblems(Component component) { diff --git a/pkg/front_end/lib/src/fasta/incremental_serializer.dart b/pkg/front_end/lib/src/fasta/incremental_serializer.dart index 5803a9ac80a..7289a1107a8 100644 --- a/pkg/front_end/lib/src/fasta/incremental_serializer.dart +++ b/pkg/front_end/lib/src/fasta/incremental_serializer.dart @@ -175,7 +175,7 @@ class IncrementalSerializer { } bool isSelfContained(Component component) { - Set got = new Set.from(component.libraries); + Set got = new Set.of(component.libraries); for (Library lib in component.libraries) { for (LibraryDependency dependency in lib.dependencies) { if (!got.contains(dependency.targetLibrary)) { diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart index 03930e4f06a..10a93893cf9 100644 --- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart +++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart @@ -1901,7 +1901,7 @@ class BodyBuilder extends ScopeListener } List? argumentsOriginalOrder; if (libraryBuilder.enableNamedArgumentsAnywhereInLibrary) { - argumentsOriginalOrder = new List.from(arguments); + argumentsOriginalOrder = new List.of(arguments); } int firstNamedArgumentIndex = arguments.length; int positionalCount = 0; @@ -1951,6 +1951,7 @@ class BodyBuilder extends ScopeListener assert( positionalIndex == positional.length && namedIndex == named.length); } else { + // arguments have non-null Expression entries after the initial loop. positional = new List.from( arguments.getRange(0, firstNamedArgumentIndex)); named = new List.from( @@ -1962,6 +1963,8 @@ class BodyBuilder extends ScopeListener } else { // TODO(kmillikin): Find a way to avoid allocating a second list in the // case where there were no named arguments, which is a common one. + + // arguments have non-null Expression entries after the initial loop. push(forest.createArguments( beginToken.offset, new List.from(arguments), argumentsOriginalOrder: argumentsOriginalOrder)); @@ -4885,8 +4888,8 @@ class BodyBuilder extends ScopeListener } List named = forest.argumentsNamed(arguments); if (named.isNotEmpty) { - Set parameterNames = - new Set.from(function.namedParameters.map((a) => a.name)); + Set parameterNames = + new Set.of(function.namedParameters.map((a) => a.name)); for (NamedExpression argument in named) { if (!parameterNames.contains(argument.name)) { return fasta.templateNoSuchNamedParameter @@ -4897,7 +4900,7 @@ class BodyBuilder extends ScopeListener } if (function.namedParameters.isNotEmpty) { if (libraryBuilder.isNonNullableByDefault) { - Set argumentNames = new Set.from(named.map((a) => a.name)); + Set argumentNames = new Set.of(named.map((a) => a.name)); for (VariableDeclaration parameter in function.namedParameters) { if (parameter.isRequired && !argumentNames.contains(parameter.name)) { return fasta.templateValueForRequiredParameterNotProvidedError @@ -4958,7 +4961,7 @@ class BodyBuilder extends ScopeListener List named = forest.argumentsNamed(arguments); if (named.isNotEmpty) { Set names = - new Set.from(function.namedParameters.map((a) => a.name)); + new Set.of(function.namedParameters.map((a) => a.name)); for (NamedExpression argument in named) { if (!names.contains(argument.name)) { return fasta.templateNoSuchNamedParameter @@ -4969,7 +4972,7 @@ class BodyBuilder extends ScopeListener } if (function.namedParameters.isNotEmpty) { if (libraryBuilder.isNonNullableByDefault) { - Set argumentNames = new Set.from(named.map((a) => a.name)); + Set argumentNames = new Set.of(named.map((a) => a.name)); for (NamedType parameter in function.namedParameters) { if (parameter.isRequired && !argumentNames.contains(parameter.name)) { return fasta.templateValueForRequiredParameterNotProvidedError @@ -6053,7 +6056,7 @@ class BodyBuilder extends ScopeListener noLocation, noLocation, // New list because the declarations are not a growable list. - new List.from( + new List.of( forest.variablesDeclarationExtractDeclarations(lvalue))); } else { effects = forest.createExpressionStatement( @@ -7147,7 +7150,7 @@ class BodyBuilder extends ScopeListener Arguments? arguments, Expression expression) { if (arguments == null) return expression; List expressions = - new List.from(forest.argumentsPositional(arguments)); + new List.of(forest.argumentsPositional(arguments)); for (NamedExpression named in forest.argumentsNamed(arguments)) { expressions.add(named.value); } diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart index 63f0ffdacfa..88168b64168 100644 --- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart +++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart @@ -286,7 +286,7 @@ class ConstantWeakener extends ComputeOnceConstantVisitor { Reference reference = entry.key; Constant? value = visitConstant(entry.value); if (value != null) { - fieldValues ??= new Map.from(node.fieldValues); + fieldValues ??= new Map.of(node.fieldValues); fieldValues[reference] = value; } } diff --git a/pkg/front_end/lib/src/fasta/kernel/forest.dart b/pkg/front_end/lib/src/fasta/kernel/forest.dart index 9ce125d419d..73decadd233 100644 --- a/pkg/front_end/lib/src/fasta/kernel/forest.dart +++ b/pkg/front_end/lib/src/fasta/kernel/forest.dart @@ -374,7 +374,7 @@ class Forest { for (int i = 0; i < statements.length; i++) { Statement statement = statements[i]; if (statement is _VariablesDeclaration) { - copy ??= new List.from(statements.getRange(0, i)); + copy ??= new List.of(statements.getRange(0, i)); copy.addAll(statement.declarations); } else if (copy != null) { copy.add(statement); @@ -592,7 +592,7 @@ class Forest { Statement wrapVariables(Statement statement) { if (statement is _VariablesDeclaration) { return new Block( - new List.from(statement.declarations, growable: true)) + new List.of(statement.declarations, growable: true)) ..fileOffset = statement.fileOffset; } else if (statement is VariableDeclaration) { return new Block([statement]) diff --git a/pkg/front_end/lib/src/fasta/kernel/hierarchy/members_node.dart b/pkg/front_end/lib/src/fasta/kernel/hierarchy/members_node.dart index 81fd945a007..f93f47eda0a 100644 --- a/pkg/front_end/lib/src/fasta/kernel/hierarchy/members_node.dart +++ b/pkg/front_end/lib/src/fasta/kernel/hierarchy/members_node.dart @@ -2352,7 +2352,7 @@ class ClassMembersNodeBuilder { } } if (contextMap.isEmpty) return; - List names = new List.from(contextMap.keys)..sort(); + List names = new List.of(contextMap.keys)..sort(); List context = []; for (int i = 0; i < names.length; i++) { context.add(contextMap[names[i]]!); diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart index 86144de67c3..33786c89b4a 100644 --- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart +++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart @@ -412,7 +412,7 @@ class KernelTarget extends TargetImplementation { installSyntheticConstructors(sourceClassBuilders); loader.resolveConstructors(); component = - link(new List.from(loader.libraries), nameRoot: nameRoot); + link(new List.of(loader.libraries), nameRoot: nameRoot); computeCoreTypes(); loader.buildClassHierarchy(sourceClassBuilders, objectClassBuilder); loader.checkSupertypes(sourceClassBuilders, enumClass); diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart index fb348d8fe93..2e98155d8b1 100644 --- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart +++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart @@ -2382,10 +2382,10 @@ class SourceClassBuilder extends ClassBuilderImpl } List sortedFromDeclared = - new List.from(declaredFunction.namedParameters) + new List.of(declaredFunction.namedParameters) ..sort(compareNamedParameters); List sortedFromInterface = - new List.from(interfaceFunction.namedParameters) + new List.of(interfaceFunction.namedParameters) ..sort(compareNamedParameters); Iterator declaredNamedParameters = sortedFromDeclared.iterator; diff --git a/pkg/front_end/lib/src/fasta/source/source_constructor_builder.dart b/pkg/front_end/lib/src/fasta/source/source_constructor_builder.dart index dcaf732f952..8f7cfc846ad 100644 --- a/pkg/front_end/lib/src/fasta/source/source_constructor_builder.dart +++ b/pkg/front_end/lib/src/fasta/source/source_constructor_builder.dart @@ -681,7 +681,7 @@ class DeclaredSourceConstructorBuilder extends SourceFunctionBuilderImpl void ensureGrowableFormals() { if (formals != null) { - formals = new List.from(formals!, growable: true); + formals = new List.of(formals!, growable: true); } else { formals = []; } diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart index a01a8c4f5b9..c67945db404 100644 --- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart +++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart @@ -1836,7 +1836,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { classScope, constructorScope, this, - new List.from(constructorReferences), + new List.of(constructorReferences), startOffset, nameOffset, endOffset, diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart index f4812504716..3e21692b238 100644 --- a/pkg/front_end/lib/src/fasta/source/source_loader.dart +++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart @@ -885,7 +885,7 @@ severity: $severity // setting a breakpoint on line 42 of some import uri mean, if the uri // represented several files? List newPathSegments = - new List.from(importUri.pathSegments); + new List.of(importUri.pathSegments); newPathSegments.add(library.fileUri.pathSegments.last); newPathSegments[0] = "${newPathSegments[0]}-patch"; importUri = importUri.replace(pathSegments: newPathSegments); diff --git a/pkg/front_end/lib/src/kernel_generator_impl.dart b/pkg/front_end/lib/src/kernel_generator_impl.dart index 2470a1a98e0..948c7566817 100644 --- a/pkg/front_end/lib/src/kernel_generator_impl.dart +++ b/pkg/front_end/lib/src/kernel_generator_impl.dart @@ -183,7 +183,7 @@ Future generateKernelInternal( includeHierarchyAndCoreTypes ? kernelTarget.loader.hierarchy : null, coreTypes: includeHierarchyAndCoreTypes ? kernelTarget.loader.coreTypes : null, - deps: new List.from(CompilerContext.current.dependencies), + deps: new List.of(CompilerContext.current.dependencies), kernelTargetForTesting: retainDataForTesting ? kernelTarget : null); }, () => sourceLoader?.currentUriForCrashReporting ?? options.inputs.first); } diff --git a/pkg/front_end/tool/generate_ast_coverage.dart b/pkg/front_end/tool/generate_ast_coverage.dart index 833e70784ee..7471ac0fcc0 100644 --- a/pkg/front_end/tool/generate_ast_coverage.dart +++ b/pkg/front_end/tool/generate_ast_coverage.dart @@ -114,7 +114,7 @@ Set missingNodes($visitorName visitor) { /// Returns the set of [${innerName}Kind]s that were not visited by [visitor]. Set<${innerName}Kind> missing${innerName}s($visitorName visitor) { Set<${innerName}Kind> all = - new Set<${innerName}Kind>.from(${innerName}Kind.values); + new Set<${innerName}Kind>.of(${innerName}Kind.values); all.removeAll(visitor.visited); return all; }'''); diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart index 51270c4c924..a2fce2fcbd6 100644 --- a/pkg/kernel/lib/ast.dart +++ b/pkg/kernel/lib/ast.dart @@ -3740,7 +3740,7 @@ class FunctionNode extends TreeNode { named.sort(); // We need create a copy of the list of type parameters, otherwise // transformations like erasure don't work. - List typeParametersCopy = new List.from( + List typeParametersCopy = new List.of( parent is Constructor ? parent.enclosingClass.typeParameters : typeParameters); @@ -3790,9 +3790,9 @@ class FunctionNode extends TreeNode { // We need create a copy of the list of type parameters, otherwise // transformations like erasure don't work. List classTypeParametersCopy = - List.from(parentConstructor.enclosingClass.typeParameters); + List.of(parentConstructor.enclosingClass.typeParameters); List typedefTypeParametersCopy = - List.from(typedef.typeParameters); + List.of(typedef.typeParameters); List asTypeArguments = getAsTypeArguments(typedefTypeParametersCopy, library); TypedefType typedefType = @@ -3834,9 +3834,9 @@ class FunctionNode extends TreeNode { "Only run this method on a factory"); // We need create a copy of the list of type parameters, otherwise // transformations like erasure don't work. - List classTypeParametersCopy = List.from(typeParameters); + List classTypeParametersCopy = List.of(typeParameters); List typedefTypeParametersCopy = - List.from(typedef.typeParameters); + List.of(typedef.typeParameters); List asTypeArguments = getAsTypeArguments(typedefTypeParametersCopy, library); TypedefType typedefType = diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart index b1f1dcdc56d..e067807a2f2 100644 --- a/pkg/kernel/lib/binary/ast_from_binary.dart +++ b/pkg/kernel/lib/binary/ast_from_binary.dart @@ -598,7 +598,7 @@ class BinaryBuilder { _byteOffset = start - 4; } _byteOffset = savedByteOffset; - return new List.from(index.reversed); + return new List.of(index.reversed); } void _checkEmptyInput() { diff --git a/pkg/kernel/lib/class_hierarchy.dart b/pkg/kernel/lib/class_hierarchy.dart index e231e8f414e..cf9320c86b3 100644 --- a/pkg/kernel/lib/class_hierarchy.dart +++ b/pkg/kernel/lib/class_hierarchy.dart @@ -929,7 +929,7 @@ class ClosedWorldClassHierarchy implements ClassHierarchy { if (_recordedAmbiguousSupertypes.isNotEmpty && reissueAmbiguousSupertypesFor != null) { Set libs = - new Set.from(reissueAmbiguousSupertypesFor.libraries); + new Set.of(reissueAmbiguousSupertypesFor.libraries); for (Class class_ in _recordedAmbiguousSupertypes.keys) { if (!libs.contains(class_.enclosingLibrary)) continue; List recorded = _recordedAmbiguousSupertypes[class_]!; @@ -1714,7 +1714,7 @@ class ClassSet extends IterableBase { } ClassSet union(ClassSet other) { - Set result = new Set.from(_classes); + Set result = new Set.of(_classes); result.addAll(other._classes); return new ClassSet(result); } diff --git a/pkg/kernel/lib/clone.dart b/pkg/kernel/lib/clone.dart index a407a138842..43d7c320db2 100644 --- a/pkg/kernel/lib/clone.dart +++ b/pkg/kernel/lib/clone.dart @@ -468,7 +468,7 @@ class CloneVisitorNotMembers implements TreeVisitor { for (SwitchCase switchCase in node.cases) { switchCases[switchCase] = new SwitchCase( switchCase.expressions.map(clone).toList(), - new List.from(switchCase.expressionOffsets), + new List.of(switchCase.expressionOffsets), dummyStatement, isDefault: switchCase.isDefault); } diff --git a/pkg/kernel/lib/src/coverage.dart b/pkg/kernel/lib/src/coverage.dart index 01b94830823..35a56929b5e 100644 --- a/pkg/kernel/lib/src/coverage.dart +++ b/pkg/kernel/lib/src/coverage.dart @@ -1145,7 +1145,7 @@ Set missingNodes(CoverageVisitor visitor) { /// Returns the set of [MemberKind]s that were not visited by [visitor]. Set missingMembers(CoverageVisitor visitor) { - Set all = new Set.from(MemberKind.values); + Set all = new Set.of(MemberKind.values); all.removeAll(visitor.visited); return all; } @@ -1153,35 +1153,35 @@ Set missingMembers(CoverageVisitor visitor) { /// Returns the set of [InitializerKind]s that were not visited by [visitor]. Set missingInitializers(CoverageVisitor visitor) { Set all = - new Set.from(InitializerKind.values); + new Set.of(InitializerKind.values); all.removeAll(visitor.visited); return all; } /// Returns the set of [ExpressionKind]s that were not visited by [visitor]. Set missingExpressions(CoverageVisitor visitor) { - Set all = new Set.from(ExpressionKind.values); + Set all = new Set.of(ExpressionKind.values); all.removeAll(visitor.visited); return all; } /// Returns the set of [StatementKind]s that were not visited by [visitor]. Set missingStatements(CoverageVisitor visitor) { - Set all = new Set.from(StatementKind.values); + Set all = new Set.of(StatementKind.values); all.removeAll(visitor.visited); return all; } /// Returns the set of [DartTypeKind]s that were not visited by [visitor]. Set missingDartTypes(CoverageVisitor visitor) { - Set all = new Set.from(DartTypeKind.values); + Set all = new Set.of(DartTypeKind.values); all.removeAll(visitor.visited); return all; } /// Returns the set of [ConstantKind]s that were not visited by [visitor]. Set missingConstants(CoverageVisitor visitor) { - Set all = new Set.from(ConstantKind.values); + Set all = new Set.of(ConstantKind.values); all.removeAll(visitor.visited); return all; } diff --git a/pkg/kernel/lib/src/standard_bounds.dart b/pkg/kernel/lib/src/standard_bounds.dart index 61590dab1df..9dc32175fec 100644 --- a/pkg/kernel/lib/src/standard_bounds.dart +++ b/pkg/kernel/lib/src/standard_bounds.dart @@ -849,7 +849,7 @@ mixin StandardBounds { int n = klass.typeParameters.length; List leftArguments = type1.typeArguments; List rightArguments = type2.typeArguments; - List typeArguments = new List.from(leftArguments); + List typeArguments = new List.of(leftArguments); for (int i = 0; i < n; ++i) { int variance = klass.typeParameters[i].variance; if (variance == Variance.contravariant) { diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart index 173d367f636..ea7721a1a95 100644 --- a/pkg/kernel/lib/target/targets.dart +++ b/pkg/kernel/lib/target/targets.dart @@ -1070,7 +1070,7 @@ mixin SummaryMixin on Target { super.performOutlineTransformations(component); if (!excludeNonSources) return; - List libraries = new List.from(component.libraries); + List libraries = new List.of(component.libraries); component.libraries.clear(); Set include = sources.toSet(); for (Library library in libraries) { diff --git a/pkg/kernel/lib/util/graph.dart b/pkg/kernel/lib/util/graph.dart index eef4b6bdefa..770826960c9 100644 --- a/pkg/kernel/lib/util/graph.dart +++ b/pkg/kernel/lib/util/graph.dart @@ -227,7 +227,7 @@ Set calculateTransitiveDependenciesOf(Graph graph, Set vertices) { } // Collect and remove all dependencies. - Set left = new Set.from(graph.vertices); + Set left = new Set.of(graph.vertices); Set transitive = {}; while (workList.isNotEmpty) { T removed = workList.removeLast();