porffor 0.27.1 → 0.27.2
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 +78 -79
- package/compiler/builtins/array.ts +4 -4
- package/compiler/builtins/porffor.d.ts +47 -3
- package/compiler/builtins/promise.ts +10 -10
- package/compiler/builtins/set.ts +5 -14
- package/compiler/builtins/symbol.ts +1 -1
- package/compiler/builtins/z_map.ts +2 -2
- package/compiler/builtins_precompiled.js +42 -48
- package/compiler/codegen.js +7 -6
- package/package.json +1 -1
- package/runner/index.js +1 -1
package/compiler/codegen.js
CHANGED
@@ -2682,7 +2682,7 @@ const typeSwitch = (scope, type, bc, returns = valtypeBinary) => {
|
|
2682
2682
|
if (Prefs.typeswitchBrtable)
|
2683
2683
|
return brTable(type, bc, returns);
|
2684
2684
|
|
2685
|
-
const tmp = localTmp(scope, '#typeswitch_tmp' + (Prefs.typeswitchUniqueTmp ?
|
2685
|
+
const tmp = localTmp(scope, '#typeswitch_tmp' + (Prefs.typeswitchUniqueTmp ? uniqId() : ''), Valtype.i32);
|
2686
2686
|
const out = [
|
2687
2687
|
...type,
|
2688
2688
|
[ Opcodes.local_set, tmp ],
|
@@ -2833,7 +2833,7 @@ const generateVar = (scope, decl) => {
|
|
2833
2833
|
for (const x of decl.declarations) {
|
2834
2834
|
if (x.id.type === 'ArrayPattern') {
|
2835
2835
|
const decls = [];
|
2836
|
-
const tmpName = '#destructure' +
|
2836
|
+
const tmpName = '#destructure' + uniqId();
|
2837
2837
|
|
2838
2838
|
let i = 0;
|
2839
2839
|
const elements = [...x.id.elements];
|
@@ -4489,7 +4489,7 @@ const makeArray = (scope, decl, global = false, name = '$undeclared', initEmpty
|
|
4489
4489
|
|
4490
4490
|
const out = [];
|
4491
4491
|
|
4492
|
-
const uniqueName = name === '$undeclared' ? name +
|
4492
|
+
const uniqueName = name === '$undeclared' ? name + uniqId() : name;
|
4493
4493
|
|
4494
4494
|
const useRawElements = !!decl.rawElements;
|
4495
4495
|
const elements = useRawElements ? decl.rawElements : decl.elements;
|
@@ -4750,7 +4750,7 @@ const generateObject = (scope, decl, global = false, name = '$undeclared') => {
|
|
4750
4750
|
];
|
4751
4751
|
|
4752
4752
|
if (decl.properties.length > 0) {
|
4753
|
-
const tmp = localTmp(scope, `#objectexpr${
|
4753
|
+
const tmp = localTmp(scope, `#objectexpr${uniqId()}`, Valtype.i32);
|
4754
4754
|
out.push([ Opcodes.local_tee, tmp ]);
|
4755
4755
|
|
4756
4756
|
for (const x of decl.properties) {
|
@@ -5164,7 +5164,8 @@ const generateMember = (scope, decl, _global, _name, _objectWasm = undefined) =>
|
|
5164
5164
|
return out;
|
5165
5165
|
};
|
5166
5166
|
|
5167
|
-
|
5167
|
+
globalThis._uniqId = 0;
|
5168
|
+
const uniqId = () => '_' + globalThis._uniqId++;
|
5168
5169
|
|
5169
5170
|
let objectHackers = [];
|
5170
5171
|
const objectHack = node => {
|
@@ -5213,7 +5214,7 @@ const objectHack = node => {
|
|
5213
5214
|
const generateFunc = (scope, decl) => {
|
5214
5215
|
if (decl.generator) return todo(scope, 'generator functions are not supported');
|
5215
5216
|
|
5216
|
-
const name = decl.id ? decl.id.name : `anonymous${
|
5217
|
+
const name = decl.id ? decl.id.name : `anonymous${uniqId()}`;
|
5217
5218
|
const params = decl.params ?? [];
|
5218
5219
|
|
5219
5220
|
// TODO: share scope/locals between !!!
|
package/package.json
CHANGED