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/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ addToLibrary({

emscripten_has_asyncify: () => {{{ ASYNCIFY }}},

emscripten_debugger: function() { debugger },
emscripten_debugger: () => { debugger },

emscripten_print_double__deps: ['$stringToUTF8', '$lengthBytesUTF8'],
emscripten_print_double: (x, to, max) => {
Expand Down
2 changes: 1 addition & 1 deletion src/library_async.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ addToLibrary({
emscripten_scan_registers: (func) => {
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_scan_registers';
},
emscripten_fiber_swap: function(oldFiber, newFiber) {
emscripten_fiber_swap: (oldFiber, newFiber) => {
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_swap';
},
#endif // ASYNCIFY
Expand Down
11 changes: 6 additions & 5 deletions src/library_bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ assert(Object.keys(LibraryManager.library).length === 0);
addToLibrary({
$callRuntimeCallbacks: () => {},

$ExitStatus__docs: '/** @constructor */',
$ExitStatus: function(status) {
this.name = 'ExitStatus';
this.message = 'Program terminated with exit(' + status + ')';
this.status = status;
$ExitStatus: class {
name = 'ExitStatus';
constructor(status) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does more than use arrow functions? Was it part of another PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sorry this should have been part of #22808

this.message = `Program terminated with exit(${status})`;
this.status = status;
}
},

$exitJS__deps: ['$ExitStatus'],
Expand Down
2 changes: 1 addition & 1 deletion src/library_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ addToLibrary({
'$strError', '$ERRNO_CODES',
#endif
],
$FS__postset: function() {
$FS__postset: () => {
// TODO: do we need noFSInit?
addAtInit(`
if (!Module['noFSInit'] && !FS.initialized)
Expand Down
2 changes: 1 addition & 1 deletion src/library_legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ legacyFuncs = {
#endif

$stackTrace__deps: ['$jsStackTrace'],
$stackTrace: function() {
$stackTrace: () => {
var js = jsStackTrace();
if (Module['extraStackTrace']) js += '\n' + Module['extraStackTrace']();
return js;
Expand Down
10 changes: 4 additions & 6 deletions src/library_stack_trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
*/

var LibraryStackTrace = {
$jsStackTrace: function() {
return new Error().stack.toString();
},
$jsStackTrace: () => new Error().stack.toString(),

$getCallstack__deps: ['$jsStackTrace', '$warnOnce'],
$getCallstack__docs: '/** @param {number=} flags */',
$getCallstack: function(flags) {
$getCallstack: (flags) => {
var callstack = jsStackTrace();

// Find the symbols in the callstack that corresponds to the functions that
Expand Down Expand Up @@ -99,7 +97,7 @@ var LibraryStackTrace = {
},

emscripten_get_callstack__deps: ['$getCallstack', '$lengthBytesUTF8', '$stringToUTF8'],
emscripten_get_callstack: function(flags, str, maxbytes) {
emscripten_get_callstack: (flags, str, maxbytes) => {
var callstack = getCallstack(flags);
// User can query the required amount of bytes to hold the callstack.
if (!str || maxbytes <= 0) {
Expand Down Expand Up @@ -205,7 +203,7 @@ var LibraryStackTrace = {
// must be able to unwind from a PC value that may no longer be on the
// execution stack, and so we are forced to cache the entire call stack.
emscripten_stack_snapshot__deps: ['$convertFrameToPC', '$UNWIND_CACHE', '$saveInUnwindCache', '$jsStackTrace'],
emscripten_stack_snapshot: function() {
emscripten_stack_snapshot: () => {
var callstack = jsStackTrace().split('\n');
if (callstack[0] == 'Error') {
callstack.shift();
Expand Down
8 changes: 3 additions & 5 deletions src/library_syscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var SyscallsLibrary = {
},

$syscallGetVarargI__internal: true,
$syscallGetVarargI: function() {
$syscallGetVarargI: () => {
#if ASSERTIONS
assert(SYSCALLS.varargs != undefined);
#endif
Expand All @@ -112,7 +112,7 @@ var SyscallsLibrary = {

$syscallGetVarargP__internal: true,
#if MEMORY64
$syscallGetVarargP: function() {
$syscallGetVarargP: () => {
#if ASSERTIONS
assert(SYSCALLS.varargs != undefined);
#endif
Expand Down Expand Up @@ -568,9 +568,7 @@ var SyscallsLibrary = {
(writefds ? {{{ makeGetValue('writefds', 4, 'i32') }}} : 0) |
(exceptfds ? {{{ makeGetValue('exceptfds', 4, 'i32') }}} : 0);

var check = function(fd, low, high, val) {
return (fd < 32 ? (low & val) : (high & val));
};
var check = (fd, low, high, val) => fd < 32 ? (low & val) : (high & val);

for (var fd = 0; fd < nfds; fd++) {
var mask = 1 << (fd % 32);
Expand Down
8 changes: 4 additions & 4 deletions src/library_trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ var LibraryTracing = {
},

emscripten_trace_record_allocation: (address, size) => {
if (typeof Module['onMalloc'] == 'function') Module['onMalloc'](address, size);
Module['onMalloc']?.(address, size);
if (EmscriptenTrace.postEnabled) {
var now = EmscriptenTrace.now();
EmscriptenTrace.post([EmscriptenTrace.EVENT_ALLOCATE,
Expand All @@ -219,7 +219,7 @@ var LibraryTracing = {
},

emscripten_trace_record_reallocation: (old_address, new_address, size) => {
if (typeof Module['onRealloc'] == 'function') Module['onRealloc'](old_address, new_address, size);
Module['onRealloc']?.(old_address, new_address, size);
if (EmscriptenTrace.postEnabled) {
var now = EmscriptenTrace.now();
EmscriptenTrace.post([EmscriptenTrace.EVENT_REALLOCATE,
Expand All @@ -228,7 +228,7 @@ var LibraryTracing = {
},

emscripten_trace_record_free: (address) => {
if (typeof Module['onFree'] == 'function') Module['onFree'](address);
Module['onFree']?.(address);
if (EmscriptenTrace.postEnabled) {
var now = EmscriptenTrace.now();
EmscriptenTrace.post([EmscriptenTrace.EVENT_FREE,
Expand Down Expand Up @@ -266,7 +266,7 @@ var LibraryTracing = {
}
},

emscripten_trace_report_off_heap_data: function () {
emscripten_trace_report_off_heap_data: () => {
function openal_audiodata_size() {
if (typeof AL == 'undefined' || !AL.currentContext) {
return 0;
Expand Down
Loading