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.
@@ -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
- const typedParams = !func.internal || func.typedParams;
176
- let argc = Math.floor(typedParams ? func.params.length / 2 : func.params.length);
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
@@ -1,6 +1,6 @@
1
1
  import type {} from './porffor.d.ts';
2
2
 
3
- export const __ArrayBuffer_isView = function (value: any): boolean {
3
+ export const __ArrayBuffer_isView = (value: any): boolean => {
4
4
  if (value.buffer) return true;
5
5
  return false;
6
6
  };
@@ -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 = __Map_prototype_keys(obj);
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 = __Map_prototype_get(obj, key);
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(' }');
@@ -189,6 +189,8 @@ export default function({ builtinFuncs }, Prefs) {
189
189
  });
190
190
  }
191
191
 
192
+ object('globalThis', {})
193
+
192
194
  if (Prefs.logMissingObjects) for (const x of Object.keys(builtinFuncs).concat(Object.keys(this))) {
193
195
  if (!x.startsWith('__')) continue;
194
196