Skip to content

Commit 4e8747a

Browse files
committed
Fix bug in common sub-expression matching
A line can have unbalanced paren. This ensures that a closing paren has a corresponding open on the same line.
1 parent 636a1b0 commit 4e8747a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/make-wgsl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const postProcessImpl = (lines: string[], indent: string): string => {
178178
const ch = line.charAt(i);
179179
if (ch === "(") {
180180
starts.push(i);
181-
} else if (ch === ")") {
181+
} else if (ch === ")" && starts.length > 0) {
182182
let start = starts.pop()!;
183183
// check previous character until either '(' or ' ' is found
184184
for (let j = start - 1; j >= 0; j--) {

0 commit comments

Comments
 (0)