Skip to content

Commit

Permalink
fix: unitest
Browse files Browse the repository at this point in the history
  • Loading branch information
Sway007 committed Dec 23, 2024
1 parent 78c1919 commit 20b1f01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/shader-lab/src/parser/AST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ export namespace ASTNode {
return this._type ?? TypeAny;
}

override set(loc: ShaderRange, children: NodeChild[]) {
super.set(loc, children);
override init(): void {
this._type = undefined;
}
}
Expand Down Expand Up @@ -694,6 +693,7 @@ export namespace ASTNode {
fnSymbol: FnSymbol | StructSymbol | undefined;

override init(): void {
super.init();
this.fnSymbol = undefined;
}

Expand Down Expand Up @@ -858,6 +858,7 @@ export namespace ASTNode {
@ASTNodeDecorator(ENonTerminal.postfix_expression)
export class PostfixExpression extends ExpressionAstNode {
override init(): void {
super.init();
if (this.children.length === 1) {
const child = this.children[0] as PrimaryExpression | FunctionCall;
this.type = child.type;
Expand All @@ -883,6 +884,7 @@ export namespace ASTNode {
@ASTNodeDecorator(ENonTerminal.multiplicative_expression)
export class MultiplicativeExpression extends ExpressionAstNode {
override init(): void {
super.init();
if (this.children.length === 1) {
this.type = (this.children[0] as UnaryExpression).type;
} else {
Expand All @@ -898,6 +900,7 @@ export namespace ASTNode {
@ASTNodeDecorator(ENonTerminal.additive_expression)
export class AdditiveExpression extends ExpressionAstNode {
override init(): void {
super.init();
if (this.children.length === 1) {
this.type = (this.children[0] as MultiplicativeExpression).type;
} else {
Expand Down

0 comments on commit 20b1f01

Please sign in to comment.