Skip to content

Commit 82491a8

Browse files
authored
Avoid extra whitespace when using asyncIf/awaitIf macros. NFC (#23237)
1 parent 66c0a02 commit 82491a8

9 files changed

+15
-15
lines changed

src/library_pthread.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ var LibraryPThread = {
10431043
'$runtimeKeepaliveCounter',
10441044
#endif
10451045
],
1046-
$invokeEntryPoint: {{{ asyncIf(ASYNCIFY == 2) }}} (ptr, arg) => {
1046+
$invokeEntryPoint: {{{ asyncIf(ASYNCIFY == 2) }}}(ptr, arg) => {
10471047
#if PTHREADS_DEBUG
10481048
dbg(`invokeEntryPoint: ${ptrToString(ptr)}`);
10491049
#endif

src/library_wasmfs_opfs.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,11 @@ addToLibrary({
319319

320320
_wasmfs_opfs_read_access__i53abi: true,
321321
_wasmfs_opfs_read_access__deps: ['$wasmfsOPFSAccessHandles'],
322-
_wasmfs_opfs_read_access: {{{ asyncIf(!PTHREADS) }}} function(accessID, bufPtr, len, pos) {
322+
_wasmfs_opfs_read_access: {{{ asyncIf(!PTHREADS) }}}function(accessID, bufPtr, len, pos) {
323323
let accessHandle = wasmfsOPFSAccessHandles.get(accessID);
324324
let data = HEAPU8.subarray(bufPtr, bufPtr + len);
325325
try {
326-
return {{{ awaitIf(!PTHREADS) }}} accessHandle.read(data, {at: pos});
326+
return {{{ awaitIf(!PTHREADS) }}}accessHandle.read(data, {at: pos});
327327
} catch (e) {
328328
if (e.name == "TypeError") {
329329
return -{{{ cDefs.EINVAL }}};
@@ -367,11 +367,11 @@ addToLibrary({
367367

368368
_wasmfs_opfs_write_access__i53abi: true,
369369
_wasmfs_opfs_write_access__deps: ['$wasmfsOPFSAccessHandles'],
370-
_wasmfs_opfs_write_access: {{{ asyncIf(!PTHREADS) }}} function(accessID, bufPtr, len, pos) {
370+
_wasmfs_opfs_write_access: {{{ asyncIf(!PTHREADS) }}}function(accessID, bufPtr, len, pos) {
371371
let accessHandle = wasmfsOPFSAccessHandles.get(accessID);
372372
let data = HEAPU8.subarray(bufPtr, bufPtr + len);
373373
try {
374-
return {{{ awaitIf(!PTHREADS) }}} accessHandle.write(data, {at: pos});
374+
return {{{ awaitIf(!PTHREADS) }}}accessHandle.write(data, {at: pos});
375375
} catch (e) {
376376
if (e.name == "TypeError") {
377377
return -{{{ cDefs.EINVAL }}};

src/parseTools.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,11 +972,11 @@ function to64(x) {
972972
}
973973

974974
function asyncIf(condition) {
975-
return condition ? 'async' : '';
975+
return condition ? 'async ' : '';
976976
}
977977

978978
function awaitIf(condition) {
979-
return condition ? 'await' : '';
979+
return condition ? 'await ' : '';
980980
}
981981

982982
// Adds a call to runtimeKeepalivePush, if needed by the current build

src/postamble.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ var mainArgs = undefined;
3636

3737
#if HAS_MAIN
3838
#if MAIN_READS_PARAMS
39-
{{{ asyncIf(ASYNCIFY == 2) }}} function callMain(args = []) {
39+
{{{ asyncIf(ASYNCIFY == 2) }}}function callMain(args = []) {
4040
#else
41-
{{{ asyncIf(ASYNCIFY == 2) }}} function callMain() {
41+
{{{ asyncIf(ASYNCIFY == 2) }}}function callMain() {
4242
#endif
4343
#if ASSERTIONS
4444
assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');

src/preamble.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ function getWasmImports() {
921921

922922
// Create the wasm instance.
923923
// Receives the wasm imports, returns the exports.
924-
{{{ asyncIf(WASM_ASYNC_COMPILATION) }}} function createWasm() {
924+
{{{ asyncIf(WASM_ASYNC_COMPILATION) }}}function createWasm() {
925925
// Load the wasm module and create an instance of using native support in the JS engine.
926926
// handle a generated wasm instance, receiving its exports and
927927
// performing other necessary setup

src/runtime_pthread.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (ENVIRONMENT_IS_PTHREAD) {
6666
// notified about them.
6767
self.onunhandledrejection = (e) => { throw e.reason || e; };
6868

69-
{{{ asyncIf(ASYNCIFY == 2) }}} function handleMessage(e) {
69+
{{{ asyncIf(ASYNCIFY == 2) }}}function handleMessage(e) {
7070
try {
7171
var msgData = e['data'];
7272
//dbg('msgData: ' + Object.keys(msgData));
@@ -177,7 +177,7 @@ if (ENVIRONMENT_IS_PTHREAD) {
177177
}
178178

179179
try {
180-
{{{ awaitIf(ASYNCIFY == 2) }}} invokeEntryPoint(msgData.start_routine, msgData.arg);
180+
{{{ awaitIf(ASYNCIFY == 2) }}}invokeEntryPoint(msgData.start_routine, msgData.arg);
181181
} catch(ex) {
182182
if (ex != 'unwind') {
183183
// The pthread "crashed". Do not call `_emscripten_thread_exit` (which
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
53888
1+
53887
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
29087
1+
29086
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
52671
1+
52670

0 commit comments

Comments
 (0)