Skip to content

Official Codebase of 3DCodeVerse

Python

runtime_js: a file the batched parse rejects is confirmed by node --check, whatever the error

gaoypenge64f049bcaa8
diff --git a/harness/runtime_js/lib/syntax_check.mjs b/harness/runtime_js/lib/syntax_check.mjs
index 59b5f516..ce2bc9c1 100644
--- a/harness/runtime_js/lib/syntax_check.mjs
+++ b/harness/runtime_js/lib/syntax_check.mjs
@@ -28,8 +28,10 @@ export function checkFiles(files) {
for (const file of files) {
try {
new vm.SourceTextModule(fs.readFileSync(file, 'utf8'), { identifier: file });
- } catch (e) {
- const hit = e instanceof SyntaxError ? checkOne(file) : { file, line: null, message: String(e), stderr: '' };
+ } catch (_e) {
+ // node --check decides: it gives a SyntaxError its line, and if vm.SourceTextModule itself
+ // is missing (an experimental API) every file still gets a correct answer, just slower
+ const hit = checkOne(file);
if (hit) bad.push(hit);
}
}