porffor 0.50.21 → 0.50.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/codegen.js +13 -12
- package/package.json +2 -2
- package/runner/index.js +15 -3
- package/ts.js +0 -198655
package/compiler/codegen.js
CHANGED
@@ -1697,14 +1697,12 @@ const getNodeType = (scope, node) => {
|
|
1697
1697
|
}
|
1698
1698
|
|
1699
1699
|
if (node.type === 'MetaProperty') {
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
}
|
1704
|
-
|
1705
|
-
default:
|
1706
|
-
return todo(scope, `meta property object ${node.meta.name} is not supported yet`, true);
|
1700
|
+
if (scope.constr && node.meta.name === 'new' && node.property.name === 'target') {
|
1701
|
+
// new.target
|
1702
|
+
return [ [ Opcodes.local_get, scope.locals['#newtarget#type'].idx ] ];
|
1707
1703
|
}
|
1704
|
+
|
1705
|
+
return TYPES.undefined;
|
1708
1706
|
}
|
1709
1707
|
|
1710
1708
|
if (node.type === 'SequenceExpression') {
|
@@ -5295,14 +5293,17 @@ const generateEmpty = (scope, decl) => {
|
|
5295
5293
|
};
|
5296
5294
|
|
5297
5295
|
const generateMeta = (scope, decl) => {
|
5298
|
-
|
5299
|
-
|
5300
|
-
|
5296
|
+
if (decl.meta.name === 'new' && decl.property.name === 'target') {
|
5297
|
+
// new.target
|
5298
|
+
if (scope.constr) return [
|
5299
|
+
[ Opcodes.local_get, scope.locals['#newtarget'].idx ]
|
5301
5300
|
];
|
5302
5301
|
|
5303
|
-
|
5304
|
-
|
5302
|
+
// not constructor so does not exist, return undefined
|
5303
|
+
return [ number(UNDEFINED) ];
|
5305
5304
|
}
|
5305
|
+
|
5306
|
+
return todo(scope, `meta property object ${decl.meta.name} is not supported yet`, true);
|
5306
5307
|
};
|
5307
5308
|
|
5308
5309
|
let pages = new Map();
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "porffor",
|
3
3
|
"description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
|
4
|
-
"version": "0.50.
|
4
|
+
"version": "0.50.23",
|
5
5
|
"author": "CanadaHonk",
|
6
6
|
"license": "MIT",
|
7
7
|
"scripts": {},
|
8
8
|
"dependencies": {
|
9
|
-
"acorn": "^8.
|
9
|
+
"acorn": "^8.14.0",
|
10
10
|
"node-repl-polyfill": "^0.1.1"
|
11
11
|
},
|
12
12
|
"optionalDependencies": {
|
package/runner/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
import fs from 'node:fs';
|
3
|
-
globalThis.version = '0.50.
|
3
|
+
globalThis.version = '0.50.23';
|
4
4
|
|
5
5
|
// deno compat
|
6
6
|
if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
|
@@ -94,8 +94,6 @@ if (['precompile', 'run', 'wasm', 'native', 'c', 'flamegraph', 'hotlines', 'debu
|
|
94
94
|
}
|
95
95
|
}
|
96
96
|
|
97
|
-
globalThis.file = file;
|
98
|
-
|
99
97
|
let source = '', printOutput = false;
|
100
98
|
if (process.argv.length >= 4) {
|
101
99
|
let evalIndex = process.argv.indexOf('-e');
|
@@ -127,6 +125,20 @@ if (process.argv.length >= 4) {
|
|
127
125
|
}
|
128
126
|
}
|
129
127
|
|
128
|
+
if (file.startsWith('https://')) { // https only :)
|
129
|
+
// rce warning, make user confirm (disabled)
|
130
|
+
// const rl = (await import('readline')).createInterface({ input: process.stdin, output: process.stdout });
|
131
|
+
// const ans = await new Promise(resolve => rl.question(`\u001b[1mAre you sure you want to download this URL:\u001b[0m ${file} (y/n)? `, ans => {
|
132
|
+
// rl.close();
|
133
|
+
// resolve(ans);
|
134
|
+
// }));
|
135
|
+
// if (ans.toLowerCase()[0] !== 'y') process.exit();
|
136
|
+
|
137
|
+
source = await (await fetch(file)).text();
|
138
|
+
}
|
139
|
+
|
140
|
+
globalThis.file = file;
|
141
|
+
|
130
142
|
if (!file && !source) {
|
131
143
|
if (process.argv.includes('-v') || process.argv.includes('--version')) {
|
132
144
|
// just print version
|