Skip to content

Commit

Permalink
wrap: simplify exception creation for lut mode
Browse files Browse the repository at this point in the history
  • Loading branch information
CanadaHonk committed Dec 5, 2024
1 parent 42f39a5 commit fc5f9f7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion compiler/wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,9 @@ export default (source, module = undefined, customImports = {}, print = str => p
// no constructor, just throw message
if (!constructorName) throw exception.message;

const constructor = globalThis[constructorName] ?? eval(`class ${constructorName} extends Error { constructor(message) { super(message); this.name = "${constructorName}"; } }; ${constructorName}`);
const err = new Error(obj.message);
err.name = constructorName;
err.stack = `${constructorName}: ${exception.message}`;
throw new constructor(exception.message);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "porffor",
"description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
"version": "0.50.14",
"version": "0.50.15",
"author": "CanadaHonk",
"license": "MIT",
"scripts": {},
Expand Down
2 changes: 1 addition & 1 deletion runner/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import fs from 'node:fs';
globalThis.version = '0.50.14';
globalThis.version = '0.50.15';

// deno compat
if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion test262/history.json

Large diffs are not rendered by default.

0 comments on commit fc5f9f7

Please sign in to comment.