Skip to content

Commit

Permalink
Apply review comments - simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau committed Dec 17, 2024
1 parent 4a4ea90 commit d7385c1
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/core/src/validate/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ function* getInitializerErrors(
baseContractDefs.map(base => [base.name, getPossibleInitializers(base, true)]),
);
const baseContractsWithInitializers = baseContractDefs
.filter(base => hasInitializers(base.name, baseContractsInitializersMap))
.filter(base => baseContractsInitializersMap.get(base.name)?.length)
.map(base => base.name);

if (baseContractsWithInitializers.length > 0) {
Expand Down Expand Up @@ -768,11 +768,6 @@ function* getInitializerErrors(
}
}

function hasInitializers(baseName: string, baseContractsInitializersMap: Map<string, FunctionDefinition[]>) {
const initializers = baseContractsInitializersMap.get(baseName);
return initializers !== undefined && initializers.length > 0;
}

function getPossibleInitializers(contractDef: ContractDefinition, isParentContract: boolean) {
const fns = [...findAll('FunctionDefinition', contractDef)];
return fns.filter(
Expand Down

0 comments on commit d7385c1

Please sign in to comment.