Skip to content

Commit 7a86519

Browse files
authored
Simplify preamble preprocessing logic. NFC (#18420)
Just include `support.js` in `shell.js`, ensures we can simplify this if-condition.
1 parent 798dbf0 commit 7a86519

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/jsifier.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,8 @@ function ${name}(${args}) {
480480
const shellFile = MINIMAL_RUNTIME ? 'shell_minimal.js' : 'shell.js';
481481
print(processMacros(preprocess(read(shellFile), shellFile)));
482482

483-
let pre;
484-
if (MINIMAL_RUNTIME) {
485-
pre = processMacros(preprocess(read('preamble_minimal.js'), 'preamble_minimal.js'));
486-
} else {
487-
pre = processMacros(preprocess(read('support.js'), 'support.js')) +
488-
processMacros(preprocess(read('preamble.js'), 'preamble.js'));
489-
}
483+
const preFile = MINIMAL_RUNTIME ? 'preamble_minimal.js' : 'preamble.js';
484+
const pre = processMacros(preprocess(read(preFile), preFile));
490485
print(pre);
491486

492487
const generated = itemsDict.functionStub.concat(itemsDict.globalVariablePostSet);

src/shell.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,3 +504,5 @@ assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at bui
504504
#endif
505505

506506
#endif // ASSERTIONS
507+
508+
#include "support.js"

0 commit comments

Comments
 (0)