Skip to content

Commit 404fde0

Browse files
authored
Use spread operator over concat in internal JS code. NFC (emscripten-core#22083)
1 parent 59d2290 commit 404fde0

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/jsifier.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ function(${args}) {
700700
}
701701
}
702702

703-
postSets = postSets.concat(orderedPostSets);
703+
postSets.push(...orderedPostSets);
704704

705705
const shellFile = MINIMAL_RUNTIME ? 'shell_minimal.js' : 'shell.js';
706706
includeFile(shellFile);

src/library_pthread.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ var LibraryPThread = {
954954
$proxyToMainThreadPtr: (...args) => BigInt(proxyToMainThread(...args)),
955955
#endif
956956
957-
$proxyToMainThread__deps: ['$stackSave', '$stackRestore', '$stackAlloc', '_emscripten_run_on_main_thread_js'].concat(i53ConversionDeps),
957+
$proxyToMainThread__deps: ['$stackSave', '$stackRestore', '$stackAlloc', '_emscripten_run_on_main_thread_js', ...i53ConversionDeps],
958958
$proxyToMainThread__docs: '/** @type{function(number, (number|boolean), ...number)} */',
959959
$proxyToMainThread: (funcIndex, emAsmAddr, sync, ...callArgs) => {
960960
// EM_ASM proxying is done by passing a pointer to the address of the EM_ASM

src/modules.mjs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,23 @@ export const LibraryManager = {
9494
if (FILESYSTEM) {
9595
libraries.push('library_fs_shared.js');
9696
if (WASMFS) {
97-
libraries = libraries.concat([
97+
libraries.push(
9898
'library_wasmfs.js',
9999
'library_wasmfs_js_file.js',
100100
'library_wasmfs_jsimpl.js',
101101
'library_wasmfs_fetch.js',
102102
'library_wasmfs_node.js',
103103
'library_wasmfs_opfs.js',
104-
]);
104+
);
105105
} else {
106106
// Core filesystem libraries (always linked against, unless -sFILESYSTEM=0 is specified)
107-
libraries = libraries.concat([
107+
libraries.push(
108108
'library_fs.js',
109109
'library_memfs.js',
110110
'library_tty.js',
111111
'library_pipefs.js', // ok to include it by default since it's only used if the syscall is used
112112
'library_sockfs.js', // ok to include it by default since it's only used if the syscall is used
113-
]);
113+
);
114114

115115
if (NODERAWFS) {
116116
// NODERAWFS requires NODEFS
@@ -126,7 +126,7 @@ export const LibraryManager = {
126126

127127
// Additional JS libraries (without AUTO_JS_LIBRARIES, link to these explicitly via -lxxx.js)
128128
if (AUTO_JS_LIBRARIES) {
129-
libraries = libraries.concat([
129+
libraries.push(
130130
'library_webgl.js',
131131
'library_html5_webgl.js',
132132
'library_openal.js',
@@ -137,7 +137,7 @@ export const LibraryManager = {
137137
'library_glew.js',
138138
'library_idbstore.js',
139139
'library_async.js',
140-
]);
140+
);
141141
if (USE_SDL != 2) {
142142
libraries.push('library_sdl.js');
143143
}
@@ -206,7 +206,7 @@ export const LibraryManager = {
206206
// These must be added last after all Emscripten-provided system libraries
207207
// above, so that users can override built-in JS library symbols in their
208208
// own code.
209-
libraries = libraries.concat(JS_LIBRARIES);
209+
libraries.push(...JS_LIBRARIES);
210210

211211
// Deduplicate libraries to avoid processing any library file multiple times
212212
libraries = libraries.filter((item, pos) => libraries.indexOf(item) == pos);
@@ -407,7 +407,7 @@ function exportRuntime() {
407407
];
408408

409409
if (PTHREADS && ALLOW_MEMORY_GROWTH) {
410-
runtimeElements = runtimeElements.concat([
410+
runtimeElements.push(
411411
'GROWABLE_HEAP_I8',
412412
'GROWABLE_HEAP_U8',
413413
'GROWABLE_HEAP_I16',
@@ -416,7 +416,7 @@ function exportRuntime() {
416416
'GROWABLE_HEAP_U32',
417417
'GROWABLE_HEAP_F32',
418418
'GROWABLE_HEAP_F64',
419-
]);
419+
);
420420
}
421421
if (USE_OFFSET_CONVERTER) {
422422
runtimeElements.push('WasmOffsetConverter');

0 commit comments

Comments
 (0)