[modular_aot] Fix number of optional named parameters when reading function types from module snapshot
TEST=ci Issue: https://github.com/dart-lang/sdk/issues/61635 Change-Id: Iaa38ca6c62f9899d2c3f0363c484dbe15e0a9859 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509523 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
ea1360fbaf
commit
7df4ef0cf1
@@ -428,8 +428,9 @@ class WrapperConstant extends ast.AuxiliaryConstant {
|
|||||||
void visitChildren(ast.Visitor v) => throw 'Should not be called.';
|
void visitChildren(ast.Visitor v) => throw 'Should not be called.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void toTextInternal(ast_printer.AstPrinter printer) =>
|
void toTextInternal(ast_printer.AstPrinter printer) {
|
||||||
throw 'Should not be called.';
|
printer.write('WrapperConstant(${unwrap})');
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ast.DartType getType(ast_type_environment.StaticTypeContext context) =>
|
ast.DartType getType(ast_type_environment.StaticTypeContext context) =>
|
||||||
|
|||||||
@@ -1057,12 +1057,14 @@ class FunctionTypeDeserializationCluster : public DeserializationCluster {
|
|||||||
const intptr_t num_fixed_params = type.num_fixed_parameters();
|
const intptr_t num_fixed_params = type.num_fixed_parameters();
|
||||||
type.set_num_implicit_parameters(1); // Implicit closure parameter.
|
type.set_num_implicit_parameters(1); // Implicit closure parameter.
|
||||||
if (num_named_params != 0) {
|
if (num_named_params != 0) {
|
||||||
type.SetNumOptionalParameters(num_params - num_named_params,
|
ASSERT(num_params - num_named_params == num_fixed_params);
|
||||||
|
type.SetNumOptionalParameters(num_named_params,
|
||||||
/* are_optional_positional=*/false);
|
/* are_optional_positional=*/false);
|
||||||
} else if (num_fixed_params != num_params) {
|
} else if (num_fixed_params != num_params) {
|
||||||
type.SetNumOptionalParameters(num_params - num_fixed_params,
|
type.SetNumOptionalParameters(num_params - num_fixed_params,
|
||||||
/* are_optional_positional=*/true);
|
/* are_optional_positional=*/true);
|
||||||
}
|
}
|
||||||
|
ASSERT(type.NumParameters() == num_params);
|
||||||
type.SetIsFinalized();
|
type.SetIsFinalized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user