Skip to content

Commit

Permalink
Shorten error handling wrapper
Browse files Browse the repository at this point in the history
This shortens pyodide.asm.js by about 5kb by reducing the space taken up by this
unreachable macro-generated code
  • Loading branch information
hoodmane committed Sep 24, 2023
1 parent 13d5e0d commit 9116451
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/core/error_handling.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ console_error_obj(JsRef obj);
Module.handle_js_error(e); \
return 0; \
} \
throw new Error( \
"Assertion error: control reached end of function without return" \
); \
errNoRet(); \
})

#define EM_JS_NUM(ret, func_name, args, body...) \
Expand Down
2 changes: 2 additions & 0 deletions src/core/pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ function hasMethod(obj, prop) {

const pyproxyIsAlive = (px) => !!Module.PyProxy_getAttrsQuiet(px).shared.ptr;
API.pyproxyIsAlive = pyproxyIsAlive;

const errNoRet = () => {throw new Error("Assertion error: control reached end of function without return");};

0 comments on commit 9116451

Please sign in to comment.