Skip to content

Commit 71d942e

Browse files
committed
Fix a crash when running the CLI tool on code with a bigint
FIX: The `acorn` CLI tool no longer crashes when emitting a tree that contains a bigint. Closes #1372
1 parent 551a680 commit 71d942e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

acorn/src/bin/acorn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function run(codeList) {
5656
console.error(fileMode ? e.message.replace(/\(\d+:\d+\)$/, m => m.slice(0, 1) + inputFilePaths[fileIdx] + " " + m.slice(1)) : e.message)
5757
process.exit(1)
5858
}
59-
if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2))
59+
if (!silent) console.log(JSON.stringify(result, (_, value) => typeof value == "bigint" ? null : value, compact ? null : 2))
6060
}
6161

6262
if (fileMode = inputFilePaths.length && (forceFileName || !inputFilePaths.includes("-") || inputFilePaths.length !== 1)) {

0 commit comments

Comments
 (0)