porffor 0.37.0 → 0.37.1
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_precompiled.js +34 -34
- package/compiler/codegen.js +9 -12
- package/package.json +1 -1
- package/runner/index.js +1 -1
- package/combined.js +0 -11575
package/compiler/codegen.js
CHANGED
@@ -1691,12 +1691,7 @@ const setObjProp = (obj, prop, value) => {
|
|
1691
1691
|
});
|
1692
1692
|
};
|
1693
1693
|
|
1694
|
-
const createThisArg = (scope, decl
|
1695
|
-
if (knownThis) {
|
1696
|
-
// todo: check compliance
|
1697
|
-
return knownThis;
|
1698
|
-
}
|
1699
|
-
|
1694
|
+
const createThisArg = (scope, decl) => {
|
1700
1695
|
const name = mapName(decl.callee?.name);
|
1701
1696
|
if (decl._new) {
|
1702
1697
|
// if precompiling or builtin func, just make empty object
|
@@ -2274,12 +2269,12 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
2274
2269
|
];
|
2275
2270
|
}
|
2276
2271
|
|
2277
|
-
let callee = decl.callee, callAsNew = decl._new
|
2272
|
+
let callee = decl.callee, callAsNew = decl._new;
|
2278
2273
|
if (callee.type === 'Super') {
|
2279
2274
|
// call super constructor with direct super() call
|
2280
2275
|
callee = getObjProp(callee, 'constructor');
|
2281
2276
|
callAsNew = true;
|
2282
|
-
|
2277
|
+
knownThis = [
|
2283
2278
|
...generate(scope, { type: 'ThisExpression' }),
|
2284
2279
|
...getNodeType(scope, { type: 'ThisExpression' })
|
2285
2280
|
];
|
@@ -2289,7 +2284,7 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
2289
2284
|
[ Opcodes.local_get, funcLocal ],
|
2290
2285
|
Opcodes.i32_from_u
|
2291
2286
|
], callAsNew);
|
2292
|
-
const thisWasm =
|
2287
|
+
const thisWasm = knownThis ?? createThisArg(scope, decl);
|
2293
2288
|
|
2294
2289
|
const gen = argc => {
|
2295
2290
|
const argsOut = [];
|
@@ -3834,7 +3829,7 @@ const generateFor = (scope, decl) => {
|
|
3834
3829
|
|
3835
3830
|
out.push([ Opcodes.br, 1 ]);
|
3836
3831
|
out.push([ Opcodes.end ], [ Opcodes.end ]);
|
3837
|
-
depth.pop(); depth.pop();
|
3832
|
+
depth.pop(); depth.pop(); depth.pop();
|
3838
3833
|
|
3839
3834
|
return out;
|
3840
3835
|
};
|
@@ -4266,6 +4261,7 @@ const generateForOf = (scope, decl) => {
|
|
4266
4261
|
depth.pop();
|
4267
4262
|
depth.pop();
|
4268
4263
|
depth.pop();
|
4264
|
+
depth.pop();
|
4269
4265
|
|
4270
4266
|
return out;
|
4271
4267
|
};
|
@@ -4385,6 +4381,7 @@ const generateForIn = (scope, decl) => {
|
|
4385
4381
|
depth.pop();
|
4386
4382
|
depth.pop();
|
4387
4383
|
depth.pop();
|
4384
|
+
depth.pop();
|
4388
4385
|
|
4389
4386
|
return typeSwitch(scope, getNodeType(scope, decl.right), {
|
4390
4387
|
// fast path for objects
|
@@ -4533,7 +4530,7 @@ const generateBreak = (scope, decl) => {
|
|
4533
4530
|
})[type];
|
4534
4531
|
|
4535
4532
|
return [
|
4536
|
-
[ Opcodes.br, ...
|
4533
|
+
[ Opcodes.br, ...unsignedLEB128(depth.length - target - offset) ]
|
4537
4534
|
];
|
4538
4535
|
};
|
4539
4536
|
|
@@ -4554,7 +4551,7 @@ const generateContinue = (scope, decl) => {
|
|
4554
4551
|
})[type];
|
4555
4552
|
|
4556
4553
|
return [
|
4557
|
-
[ Opcodes.br, ...
|
4554
|
+
[ Opcodes.br, ...unsignedLEB128(depth.length - target - offset) ]
|
4558
4555
|
];
|
4559
4556
|
};
|
4560
4557
|
|
package/package.json
CHANGED