porffor 0.24.12 → 0.24.13
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/assemble.js +6 -7
- package/compiler/builtins/arraybuffer.ts +1 -1
- package/compiler/builtins/console.ts +3 -3
- package/compiler/builtins_objects.js +2 -0
- package/compiler/builtins_precompiled.js +980 -446
- package/compiler/codegen.js +298 -110
- package/compiler/precompile.js +4 -2
- package/package.json +1 -1
- package/runner/index.js +1 -1
package/compiler/assemble.js
CHANGED
@@ -114,11 +114,6 @@ export default (funcs, globals, tags, pages, data, flags, noTreeshake = false) =
|
|
114
114
|
params.push(valtypeBinary, Valtype.i32);
|
115
115
|
}
|
116
116
|
|
117
|
-
if (inst.at(-1) === 'constr') {
|
118
|
-
inst.pop();
|
119
|
-
params.unshift(Valtype.i32);
|
120
|
-
}
|
121
|
-
|
122
117
|
let returns = [ valtypeBinary, Valtype.i32 ];
|
123
118
|
if (inst.at(-1) === 'no_type_return') {
|
124
119
|
inst.pop();
|
@@ -172,8 +167,10 @@ export default (funcs, globals, tags, pages, data, flags, noTreeshake = false) =
|
|
172
167
|
const func = funcs[i];
|
173
168
|
let name = func.name;
|
174
169
|
|
175
|
-
|
176
|
-
|
170
|
+
let argc = func.params.length;
|
171
|
+
if (func.newTarget) argc -= 2;
|
172
|
+
if (func.usesThis) argc -= 2;
|
173
|
+
if (!func.internal || func.typedParams) argc = Math.floor(argc / 2);
|
177
174
|
|
178
175
|
// hack: argc-- for prototype methods to remove _this hack from count
|
179
176
|
if (name.includes('_prototype_')) argc--;
|
@@ -183,6 +180,8 @@ export default (funcs, globals, tags, pages, data, flags, noTreeshake = false) =
|
|
183
180
|
let flags = 0b00000000; // 8 flag bits
|
184
181
|
if (func.returnType != null) flags |= 0b1;
|
185
182
|
if (func.constr) flags |= 0b10;
|
183
|
+
if (func.newTarget) flags |= 0b100;
|
184
|
+
if (func.usesThis) flags |= 0b1000;
|
186
185
|
bytes.push(flags);
|
187
186
|
|
188
187
|
// eg: __String_prototype_toLowerCase -> toLowerCase
|
@@ -516,17 +516,17 @@ export const __Porffor_dirObject = (obj: any, colors: boolean, depth: i32, showH
|
|
516
516
|
|
517
517
|
printStatic('{ ');
|
518
518
|
|
519
|
-
const keys =
|
519
|
+
const keys = __Object_keys(obj);
|
520
520
|
const keysLen = keys.length - 1;
|
521
521
|
for (let i = 0; i <= keysLen; i++) {
|
522
522
|
const key = keys[i];
|
523
523
|
__Porffor_consolePrint(key);
|
524
524
|
printStatic(': ');
|
525
525
|
|
526
|
-
const value =
|
526
|
+
const value = __Porffor_object_get(obj, key);
|
527
527
|
__Porffor_dirObject(value, colors, depth - 1, showHidden);
|
528
528
|
|
529
|
-
if (i != keysLen) printStatic(',');
|
529
|
+
if (i != keysLen) printStatic(', ');
|
530
530
|
}
|
531
531
|
|
532
532
|
printStatic(' }');
|