porffor 0.20.8 → 0.20.9
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/builtins/_internal_object.ts +91 -0
- package/compiler/builtins/object.ts +51 -14
- package/compiler/builtins/weakref.ts +1 -1
- package/compiler/builtins/z_ecma262.ts +1 -2
- package/compiler/builtins/z_map.ts +1 -1
- package/compiler/builtins/z_weakmap.ts +2 -2
- package/compiler/builtins/z_weakset.ts +1 -1
- package/compiler/codegen.js +4 -3
- package/compiler/generated_builtins.js +51 -22
- package/compiler/precompile.js +3 -2
- package/compiler/wrap.js +9 -3
- package/package.json +1 -1
- package/runner/index.js +1 -1
package/compiler/precompile.js
CHANGED
@@ -24,7 +24,7 @@ const compile = async (file, _funcs) => {
|
|
24
24
|
first = source.slice(0, source.indexOf('\n'));
|
25
25
|
}
|
26
26
|
|
27
|
-
let args = ['--bytestring', '--todo-time=compile', '--truthy=no_nan_negative', '--no-treeshake-wasm-imports', '--no-rm-unused-types', '--scoped-page-names', '--funsafe-no-unlikely-proto-checks', '--fast-length', '--
|
27
|
+
let args = ['--bytestring', '--todo-time=compile', '--truthy=no_nan_negative', '--no-treeshake-wasm-imports', '--no-rm-unused-types', '--scoped-page-names', '--funsafe-no-unlikely-proto-checks', '--fast-length', '--parse-types', '--opt-types'];
|
28
28
|
if (first.startsWith('// @porf')) {
|
29
29
|
args = first.slice('// @porf '.length).split(' ').concat(args);
|
30
30
|
}
|
@@ -48,6 +48,7 @@ const compile = async (file, _funcs) => {
|
|
48
48
|
|
49
49
|
const paramOverrides = {
|
50
50
|
__Porffor_object_set: [ Valtype.i32, Valtype.i32, Valtype.i32, Valtype.i32, Valtype.f64, Valtype.i32 ],
|
51
|
+
__Porffor_object_define: [ Valtype.i32, Valtype.i32, Valtype.i32, Valtype.i32, Valtype.f64, Valtype.i32, Valtype.i32, Valtype.i32 ],
|
51
52
|
};
|
52
53
|
|
53
54
|
const main = funcs.find(x => x.name === 'main');
|
@@ -113,7 +114,7 @@ const compile = async (file, _funcs) => {
|
|
113
114
|
if (y[0] === Opcodes.const && (n[0] === Opcodes.local_set || n[0] === Opcodes.local_tee)) {
|
114
115
|
const l = locals[n[1]];
|
115
116
|
if (!l) continue;
|
116
|
-
if (![TYPES.string, TYPES.array, TYPES.bytestring].includes(l.metadata?.type)) continue;
|
117
|
+
if (!['#member_prop'].includes(l.name) && ![TYPES.string, TYPES.array, TYPES.bytestring].includes(l.metadata?.type)) continue;
|
117
118
|
if (!x.pages) continue;
|
118
119
|
|
119
120
|
const pageName = [...x.pages.keys()].find(z => z.endsWith(l.name));
|
package/compiler/wrap.js
CHANGED
@@ -67,7 +67,7 @@ const porfToJSValue = ({ memory, funcs, pages }, value, type) => {
|
|
67
67
|
if (Prefs.d) {
|
68
68
|
console.log(`\x1b[4m\x1b[1m${k}\x1b[0m \x1B[90m(${TYPE_NAMES[kType]})\x1B[0m
|
69
69
|
value: \x1B[92m${v}\x1B[0m \x1B[90m(${TYPE_NAMES[vType]})\x1B[0m
|
70
|
-
flags: 0b\x1B[93m${flags.toString(2)}\x1B[0m\x1B[90m
|
70
|
+
flags: 0b\x1B[93m${flags.toString(2).padStart(4, '0')}\x1B[0m\x1B[90m
|
71
71
|
accessor: ${!!(flags & 0b0001)}
|
72
72
|
configurable: ${!!(flags & 0b0010)}
|
73
73
|
enumerable: ${!!(flags & 0b0100)}
|
@@ -75,8 +75,14 @@ const porfToJSValue = ({ memory, funcs, pages }, value, type) => {
|
|
75
75
|
\x1B[0m`);
|
76
76
|
}
|
77
77
|
|
78
|
-
|
79
|
-
|
78
|
+
const configurable = flags & 0b0010;
|
79
|
+
const enumerable = flags & 0b0100;
|
80
|
+
|
81
|
+
Object.defineProperty(out, k, {
|
82
|
+
value: v,
|
83
|
+
configurable,
|
84
|
+
enumerable,
|
85
|
+
});
|
80
86
|
}
|
81
87
|
|
82
88
|
return out;
|
package/package.json
CHANGED