Skip to content

Commit

Permalink
[cfe] Remove unknownFunction
Browse files Browse the repository at this point in the history
The `unknownFunction` marker object was used to indicate a type of a
function that accepts an unspecified amount of arguments. The uses of
the marker object in the CFE are already replaced by
InvocationTargetType and its subtypes. This CL simply removes the
object itself, which is no longer in use.

Change-Id: I48fe53460d1f96f4fee0a91fb1572e219fbd1502
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387702
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
  • Loading branch information
chloestefantsova authored and Commit Queue committed Oct 1, 2024
1 parent a101a99 commit 7bb6899
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
10 changes: 4 additions & 6 deletions pkg/front_end/lib/src/type_inference/type_inference_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ abstract class TypeInferenceEngine {
/// kernel objects.
class TypeInferenceEngineImpl extends TypeInferenceEngine {
final Benchmarker? benchmarker;
final FunctionType unknownFunction =
new FunctionType(const [], const DynamicType(), Nullability.nonNullable);

TypeInferenceEngineImpl(Instrumentation? instrumentation, this.benchmarker)
: super(instrumentation);
Expand All @@ -364,11 +362,11 @@ class TypeInferenceEngineImpl extends TypeInferenceEngine {
}
if (benchmarker == null) {
return new TypeInferrerImpl(this, uri, false, thisType, library,
assignedVariables, dataForTesting, unknownFunction);
assignedVariables, dataForTesting);
}
// Coverage-ignore(suite): Not run.
return new TypeInferrerImplBenchmarked(this, uri, false, thisType, library,
assignedVariables, dataForTesting, benchmarker!, unknownFunction);
assignedVariables, dataForTesting, benchmarker!);
}

/// Creates a [TypeInferrer] object which is ready to perform type inference
Expand All @@ -386,11 +384,11 @@ class TypeInferenceEngineImpl extends TypeInferenceEngine {
}
if (benchmarker == null) {
return new TypeInferrerImpl(this, uri, true, thisType, library,
assignedVariables, dataForTesting, unknownFunction);
assignedVariables, dataForTesting);
}
// Coverage-ignore(suite): Not run.
return new TypeInferrerImplBenchmarked(this, uri, true, thisType, library,
assignedVariables, dataForTesting, benchmarker!, unknownFunction);
assignedVariables, dataForTesting, benchmarker!);
}
}

Expand Down
20 changes: 3 additions & 17 deletions pkg/front_end/lib/src/type_inference/type_inferrer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ abstract class TypeInferrer {
/// Concrete implementation of [TypeInferrer] specialized to work with kernel
/// objects.
class TypeInferrerImpl implements TypeInferrer {
/// Marker object to indicate that a function takes an unknown number
/// of arguments.
final FunctionType unknownFunction;

final TypeInferenceEngine engine;

final OperationsCfe operations;
Expand Down Expand Up @@ -132,8 +128,7 @@ class TypeInferrerImpl implements TypeInferrer {
this.thisType,
this.libraryBuilder,
this.assignedVariables,
this.dataForTesting,
this.unknownFunction)
this.dataForTesting)
: instrumentation = isTopLevel ? null : engine.instrumentation,
typeSchemaEnvironment = engine.typeSchemaEnvironment,
operations = new OperationsCfe(engine.typeSchemaEnvironment,
Expand Down Expand Up @@ -307,17 +302,8 @@ class TypeInferrerImplBenchmarked implements TypeInferrer {
AssignedVariables<TreeNode, VariableDeclaration> assignedVariables,
InferenceDataForTesting? dataForTesting,
this.benchmarker,
FunctionType unknownFunctionNonNullable,
) : impl = new TypeInferrerImpl(
engine,
uriForInstrumentation,
topLevel,
thisType,
library,
assignedVariables,
dataForTesting,
unknownFunctionNonNullable,
);
) : impl = new TypeInferrerImpl(engine, uriForInstrumentation, topLevel,
thisType, library, assignedVariables, dataForTesting);

@override
AssignedVariables<TreeNode, VariableDeclaration> get assignedVariables =>
Expand Down

0 comments on commit 7bb6899

Please sign in to comment.