Skip to content

Commit

Permalink
remove formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNeshi committed Feb 25, 2025
1 parent f7530ec commit 313ed68
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions packages/core/stylus/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,7 @@ export class ContractBuilder implements Contract {
const uniqueName = alias.length > 0 ? alias : name;
const present = this.useClausesMap.has(uniqueName);
if (!present) {
this.useClausesMap.set(uniqueName, {
containerPath,
name,
groupable,
alias,
});
this.useClausesMap.set(uniqueName, { containerPath, name, groupable, alias });
}
}

Expand Down Expand Up @@ -147,21 +142,15 @@ export class ContractBuilder implements Contract {
return this.implementedTraitsMap.has(name);
}

addFunction(
baseTrait: BaseImplementedTrait,
fn: BaseFunction
): ContractFunction {
addFunction(baseTrait: BaseImplementedTrait, fn: BaseFunction): ContractFunction {
const t = this.addImplementedTrait(baseTrait);

const signature = this.getFunctionSignature(fn);

// Look for the existing function with the same signature and return it if found
for (let i = 0; i < t.functions.length; i++) {
const existingFn = t.functions[i];
if (
existingFn !== undefined &&
this.getFunctionSignature(existingFn) === signature
) {
if (existingFn !== undefined && this.getFunctionSignature(existingFn) === signature) {
return existingFn;
}
}
Expand All @@ -179,21 +168,13 @@ export class ContractBuilder implements Contract {
return [fn.name, '(', ...fn.args.map(a => a.name), ')'].join('');
}

addFunctionCodeBefore(
baseTrait: BaseImplementedTrait,
fn: BaseFunction,
codeBefore: string[]
): void {
addFunctionCodeBefore(baseTrait: BaseImplementedTrait, fn: BaseFunction, codeBefore: string[]): void {
this.addImplementedTrait(baseTrait);
const existingFn = this.addFunction(baseTrait, fn);
existingFn.codeBefore = [...(existingFn.codeBefore ?? []), ...codeBefore];
}

addFunctionTag(
baseTrait: BaseImplementedTrait,
fn: BaseFunction,
tag: string
): void {
addFunctionTag(baseTrait: BaseImplementedTrait, fn: BaseFunction, tag: string): void {
this.addImplementedTrait(baseTrait);
const existingFn = this.addFunction(baseTrait, fn);
existingFn.tag = tag;
Expand Down

0 comments on commit 313ed68

Please sign in to comment.