Skip to content

Commit

Permalink
feat: remove redundent code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sway007 committed Jan 8, 2025
1 parent 1171cf8 commit 1f2414a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/shader-lab/src/parser/builtin/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ function isGenericType(t: BuiltinType) {
const BuiltinFunctionTable: Map<string, BuiltinFunction[]> = new Map();

export class BuiltinFunction {
private _returnType: BuiltinType;
ident: string;
readonly args: BuiltinType[];
readonly scope: EShaderStage;
signatures: NonGenericGalaceanType[] = [];

private _returnType: BuiltinType;
private _realReturnType: NonGenericGalaceanType;

get realReturnType(): NonGenericGalaceanType {
return this.signatures[0];
return this._realReturnType;
}

private constructor(ident: string, returnType: BuiltinType, scope: EShaderStage, ...args: BuiltinType[]) {
Expand Down Expand Up @@ -87,11 +88,7 @@ export class BuiltinFunction {
}
}
if (found) {
fn.signatures.length = 0;
fn.signatures.push(returnType);
for (let i = 0; i < argLength; i++) {
fn.signatures.push(parameterTypes[i]);
}
fn._realReturnType = returnType;
return fn;
}
}
Expand Down

0 comments on commit 1f2414a

Please sign in to comment.