Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/jsifier.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function stringifyWithFunctions(obj) {
if (typeof value === 'function' && (str.startsWith(key) || str.startsWith('async ' + key))) {
rtn += str + ',\n';
} else {
rtn += escapeJSONKey(key) + ':' + str + ',\n';
rtn += `${escapeJSONKey(key)}:${str},\n`;
}
}
return rtn + '}';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/libbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,8 @@ var LibraryBrowser = {
emscripten_run_preload_plugins_data: (data, size, suffix, arg, onload, onerror) => {
{{{ runtimeKeepalivePush() }}}

var _suffix = UTF8ToString(suffix);
var name = 'prepare_data_' + (Browser_asyncPrepareDataCounter++) + '.' + _suffix;
suffix = UTF8ToString(suffix);
var name = `prepare_data_${Browser_asyncPrepareDataCounter++}.${suffix}`;
var cname = stringToNewUTF8(name);
FS.createPreloadedFile(
'/',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/libccall.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ addToLibrary({
$getCFunc: (ident) => {
var func = Module['_' + ident]; // closure exported function
#if ASSERTIONS
assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported');
assert(func, `Cannot call unknown function ${ident}, make sure it is exported`);
#endif
return func;
},
Expand Down Expand Up @@ -112,7 +112,7 @@ addToLibrary({
// We need to return a Promise that resolves the return value
// once the stack is rewound and execution finishes.
#if ASSERTIONS
assert(asyncMode, 'The call to ' + ident + ' is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.');
assert(asyncMode, `The call to ${ident} is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.`);
#endif
return Asyncify.whenDone().then(onDone);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libcore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2593,7 +2593,7 @@ function wrapSyscallFunction(x, library, isWasi) {
t = modifyJSFunction(t, (args, body, async_) => `${async_}function (${args}) {\n${pre}${body}${post}}\n`);
}

library[x] = eval('(' + t + ')');
library[x] = eval(`(${t})`);
// Automatically add dependency on `$SYSCALLS`
if (!WASMFS && t.includes('SYSCALLS')) {
library[x + '__deps'].push('$SYSCALLS');
Expand Down
27 changes: 13 additions & 14 deletions src/lib/libsdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1066,16 +1066,16 @@ var LibrarySDL = {
{{{ makeSetValue('ptr', C_STRUCTS.SDL_WindowEvent.event, 'visibilityEventID' , 'i8') }}};
break;
}
default: abort('Unhandled SDL event: ' + event.type);
default: abort(`Unhandled SDL event: ${event.type}`);
}
},

makeFontString(height, fontName) {
if (fontName.charAt(0) != "'" && fontName.charAt(0) != '"') {
if (fontName[0] != "'" && fontName[0] != '"') {
// https://developer.mozilla.org/ru/docs/Web/CSS/font-family
// Font family names containing whitespace should be quoted.
// BTW, quote all font names is easier than searching spaces
fontName = '"' + fontName + '"';
fontName = `"${fontName}"`;
}
return height + 'px ' + fontName + ', serif';
},
Expand Down Expand Up @@ -1222,7 +1222,7 @@ var LibrarySDL = {
for (var c = 0; c < numChannels; ++c) {
var channelData = dstAudioBuffer['getChannelData'](c);
if (channelData.length != sizeSamplesPerChannel) {
abort('Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + sizeSamplesPerChannel + ' samples!');
abort(`Web Audio output buffer length mismatch! Destination size: ${channelData.length} samples vs expected ${sizeSamplesPerChannel} samples!`);
}
if (audio.format == {{{ cDefs.AUDIO_S16LSB }}}) {
for (var j = 0; j < sizeSamplesPerChannel; ++j) {
Expand All @@ -1238,7 +1238,7 @@ var LibrarySDL = {
channelData[j] = ({{{ makeGetValue('heapPtr', '(j*numChannels + c)*4', 'float') }}});
}
} else {
abort('Invalid SDL audio format ' + audio.format + '!');
abort(`Invalid SDL audio format ${audio.format}!`);
}
}
},
Expand Down Expand Up @@ -2264,8 +2264,8 @@ var LibrarySDL = {
raw = callStbImage('stbi_load', [name]);
if (!raw) return 0;
#else
warnOnce('Cannot find preloaded image ' + filename);
warnOnce('Cannot find preloaded image ' + filename + '. Consider using STB_IMAGE=1 if you want synchronous image decoding (see settings.js), or package files with --use-preload-plugins');
warnOnce(`Cannot find preloaded image ${filename}`);
warnOnce(`Cannot find preloaded image ${filename}. Consider using STB_IMAGE=1 if you want synchronous image decoding (see settings.js), or package files with --use-preload-plugins`);
return 0;
#endif
} else if (Module['freePreloadedMediaOnUse']) {
Expand All @@ -2275,7 +2275,7 @@ var LibrarySDL = {

var surf = SDL.makeSurface(raw.width, raw.height, 0, false, 'load:' + filename);
var surfData = SDL.surfaces[surf];
surfData.ctx.globalCompositeOperation = "copy";
surfData.ctx.globalCompositeOperation = 'copy';
if (!raw.rawData) {
surfData.ctx.drawImage(raw, 0, 0, raw.width, raw.height, 0, 0, raw.width, raw.height);
} else {
Expand Down Expand Up @@ -2385,12 +2385,12 @@ var LibrarySDL = {
} else if (SDL.audio.format == {{{ cDefs.AUDIO_F32 }}}) {
SDL.audio.silence = 0.0; // Float data in range [-1.0, 1.0], silence is 0.0
} else {
abort('Invalid SDL audio format ' + SDL.audio.format + '!');
abort(`Invalid SDL audio format ${SDL.audio.format}!`);
}
// Round the desired audio frequency up to the next 'common' frequency value.
// Web Audio API spec states 'An implementation must support sample-rates in at least the range 22050 to 96000.'
if (SDL.audio.freq <= 0) {
abort('Unsupported sound frequency ' + SDL.audio.freq + '!');
abort(`Unsupported sound frequency ${SDL.audio.freq}!`);
} else if (SDL.audio.freq <= 22050) {
SDL.audio.freq = 22050; // Take it safe and clamp everything lower than 22kHz to that.
} else if (SDL.audio.freq <= 32000) {
Expand Down Expand Up @@ -3137,8 +3137,7 @@ var LibrarySDL = {
#if ASSERTIONS
// Check the final context looks valid. See
// https://github.com/emscripten-core/emscripten/issues/16242
assert(typeof SDL.ttfContext.measureText == 'function',
'context ' + SDL.ttfContext + 'must provide valid methods');
assert(typeof SDL.ttfContext.measureText == 'function', `context ${SDL.ttfContext} must provide valid methods`);
#endif
return 0;
},
Expand Down Expand Up @@ -3357,7 +3356,7 @@ var LibrarySDL = {
SDL_GL_SetAttribute__proxy: 'sync',
SDL_GL_SetAttribute: (attr, value) => {
if (!(attr in SDL.glAttributes)) {
abort('Unknown SDL GL attribute (' + attr + '). Please check if your SDL version is supported.');
abort(`Unknown SDL GL attribute (${attr}). Please check if your SDL version is supported.`);
}

SDL.glAttributes[attr] = value;
Expand All @@ -3366,7 +3365,7 @@ var LibrarySDL = {
SDL_GL_GetAttribute__proxy: 'sync',
SDL_GL_GetAttribute: (attr, value) => {
if (!(attr in SDL.glAttributes)) {
abort('Unknown SDL GL attribute (' + attr + '). Please check if your SDL version is supported.');
abort(`Unknown SDL GL attribute (${attr}). Please check if your SDL version is supported.`);
}

if (value) {{{ makeSetValue('value', 0, 'SDL.glAttributes[attr]', 'i32') }}};
Expand Down
4 changes: 2 additions & 2 deletions src/lib/libstrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ addToLibrary({
u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
} else {
#if ASSERTIONS
if ((u0 & 0xF8) != 0xF0) warnOnce('Invalid UTF-8 leading byte ' + ptrToString(u0) + ' encountered when deserializing a UTF-8 string in wasm memory to a JS string!');
if ((u0 & 0xF8) != 0xF0) warnOnce(`Invalid UTF-8 leading byte ${ptrToString(u0)} encountered when deserializing a UTF-8 string in wasm memory to a JS string!`);
#endif
u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
}
Expand Down Expand Up @@ -186,7 +186,7 @@ addToLibrary({
} else {
if (outIdx + 3 >= endIdx) break;
#if ASSERTIONS
if (u > 0x10FFFF) warnOnce('Invalid Unicode code point ' + ptrToString(u) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).');
if (u > 0x10FFFF) warnOnce(`Invalid Unicode code point ${ptrToString(u)} encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).`);
#endif
heap[outIdx++] = 0xF0 | (u >> 18);
heap[outIdx++] = 0x80 | ((u >> 12) & 63);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libsyscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ var SyscallsLibrary = {
if (info.errno) throw new FS.ErrnoError(info.errno);
info.addr = DNS.lookup_addr(info.addr) || info.addr;
#if SYSCALL_DEBUG
dbg(' (socketaddress: "' + [info.addr, info.port] + '")');
dbg(` (socketaddress: "${[info.addr, info.port]}")`);
#endif
return info;
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libwasmfs_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ addToLibrary({
$wasmfsNodeConvertNodeCode: (e) => {
var code = e.code;
#if ASSERTIONS
assert(code in ERRNO_CODES, 'unexpected node error code: ' + code + ' (' + e + ')');
assert(code in ERRNO_CODES, `unexpected node error code: ${code} (${e})`);
#endif
return ERRNO_CODES[code];
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libwebaudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ var LibraryWebAudio = {
assert(stackLowestAddress % 16 == 0, `AudioWorklet stack should be aligned to 16 bytes! (was ${stackLowestAddress} == ${stackLowestAddress%16} mod 16) Use e.g. memalign(16, stackSize) to align the stack!`);
assert(stackSize != 0, 'AudioWorklets require a dedicated stack space for audio data marshalling between Wasm and JS!');
assert(stackSize % 16 == 0, `AudioWorklet stack size should be a multiple of 16 bytes! (was ${stackSize} == ${stackSize%16} mod 16)`);
assert(!audioContext.audioWorkletInitialized, 'emscripten_create_wasm_audio_worklet() was already called for AudioContext ' + contextHandle + '! Only call this function once per AudioContext!');
assert(!audioContext.audioWorkletInitialized, `emscripten_create_wasm_audio_worklet() was already called for AudioContext ${contextHandle}! Only call this function once per AudioContext!`);
audioContext.audioWorkletInitialized = 1;
#endif

Expand Down
Loading
Loading