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.
@@ -16,22 +16,22 @@ import type {} from './porffor.d.ts';
16
16
  // enumerable - 0b0100
17
17
  // writable - 0b1000
18
18
 
19
- export const __Porffor_object_preventExtensions = (ptr: object) => {
20
- let rootFlags: i32 = Porffor.wasm.i32.load8_u(ptr, 0, 4);
19
+ export const __Porffor_object_preventExtensions = (obj: object): void => {
20
+ let rootFlags: i32 = Porffor.wasm.i32.load8_u(obj, 0, 4);
21
21
  rootFlags |= 0b0001;
22
- Porffor.wasm.i32.store8(ptr, rootFlags, 0, 4);
22
+ Porffor.wasm.i32.store8(obj, rootFlags, 0, 4);
23
23
  };
24
24
 
25
- export const __Porffor_object_isInextensible = (ptr: object): boolean => {
26
- const out: boolean = Porffor.wasm.i32.load8_u(ptr, 0, 4) & 0b0001;
25
+ export const __Porffor_object_isInextensible = (obj: object): boolean => {
26
+ const out: boolean = Porffor.wasm.i32.load8_u(obj, 0, 4) & 0b0001;
27
27
  return out;
28
28
  };
29
29
 
30
30
 
31
- export const __Porffor_object_overrideAllFlags = (_this: object, overrideOr: i32, overrideAnd: i32) => {
32
- let ptr: i32 = Porffor.wasm`local.get ${_this}` + 5;
31
+ export const __Porffor_object_overrideAllFlags = (obj: object, overrideOr: i32, overrideAnd: i32): void => {
32
+ let ptr: i32 = Porffor.wasm`local.get ${obj}` + 5;
33
33
 
34
- const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
34
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
35
35
  const endPtr: i32 = ptr + size * 14;
36
36
 
37
37
  for (; ptr < endPtr; ptr += 14) {
@@ -41,10 +41,10 @@ export const __Porffor_object_overrideAllFlags = (_this: object, overrideOr: i32
41
41
  }
42
42
  };
43
43
 
44
- export const __Porffor_object_checkAllFlags = (_this: object, dataAnd: i32, accessorAnd: i32, dataExpected: i32, accessorExpected: i32): boolean => {
45
- let ptr: i32 = Porffor.wasm`local.get ${_this}` + 5;
44
+ export const __Porffor_object_checkAllFlags = (obj: object, dataAnd: i32, accessorAnd: i32, dataExpected: i32, accessorExpected: i32): boolean => {
45
+ let ptr: i32 = Porffor.wasm`local.get ${obj}` + 5;
46
46
 
47
- const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
47
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
48
48
  const endPtr: i32 = ptr + size * 14;
49
49
 
50
50
  for (; ptr < endPtr; ptr += 14) {
@@ -101,12 +101,12 @@ export const __Porffor_object_accessorSet = (entryPtr: i32): Function => {
101
101
  };
102
102
 
103
103
 
104
- export const __Porffor_object_lookup = (_this: object, target: any): i32 => {
104
+ export const __Porffor_object_lookup = (obj: object, target: any): i32 => {
105
105
  const targetType: i32 = Porffor.wasm`local.get ${target+1}`;
106
106
 
107
- let ptr: i32 = Porffor.wasm`local.get ${_this}` + 5;
107
+ let ptr: i32 = Porffor.wasm`local.get ${obj}` + 5;
108
108
 
109
- const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
109
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
110
110
  const endPtr: i32 = ptr + size * 14;
111
111
 
112
112
  if (targetType == Porffor.TYPES.bytestring) {
@@ -135,22 +135,21 @@ export const __Porffor_object_lookup = (_this: object, target: any): i32 => {
135
135
  const keyRaw: i32 = Porffor.wasm.i32.load(ptr, 0, 0);
136
136
  if (keyRaw == 0) break; // ran out of keys
137
137
  if (keyRaw >>> 30 == 3) { // MSB 1 and 2 set, symbol
138
- const keySym: symbol = keyRaw & 0x3FFFFFFF; // unset MSB
139
- if (keySym == targetSym) return ptr;
140
- }
138
+ const keySym: symbol = keyRaw & 0x3FFFFFFF; // unset MSB
139
+ if (keySym == targetSym) return ptr;
141
140
  }
142
141
  }
143
-
142
+ }
144
143
 
145
144
  return -1;
146
145
  };
147
146
 
148
- export const __Porffor_object_get = (_this: any, key: any): any => {
149
- if (Porffor.wasm`local.get ${_this+1}` == Porffor.TYPES.function) {
147
+ export const __Porffor_object_get = (obj: any, key: any): any => {
148
+ if (Porffor.wasm`local.get ${obj+1}` == Porffor.TYPES.function) {
150
149
  let tmp: bytestring = '';
151
150
  tmp = 'name';
152
151
  if (key == tmp) {
153
- const o: bytestring = __Porffor_funcLut_name(_this);
152
+ const o: bytestring = __Porffor_funcLut_name(obj);
154
153
  const t: i32 = Porffor.TYPES.bytestring;
155
154
  Porffor.wasm`
156
155
  local.get ${o}
@@ -161,7 +160,7 @@ return`;
161
160
 
162
161
  tmp = 'length';
163
162
  if (key == tmp) {
164
- const o: i32 = __Porffor_funcLut_length(_this);
163
+ const o: i32 = __Porffor_funcLut_length(obj);
165
164
  Porffor.wasm`
166
165
  local.get ${o}
167
166
  f64.convert_i32_u
@@ -176,7 +175,7 @@ i32.const 128
176
175
  return`;
177
176
  }
178
177
 
179
- const entryPtr: i32 = __Porffor_object_lookup(_this, key);
178
+ const entryPtr: i32 = __Porffor_object_lookup(obj, key);
180
179
  if (entryPtr == -1) {
181
180
  Porffor.wasm`
182
181
  f64.const 0
@@ -198,15 +197,15 @@ i32.const 128
198
197
  return`;
199
198
  }
200
199
 
201
- const funcFlags: i32 = Porffor.funcLut.flags(get);
200
+ const funcFlags: i32 = __Porffor_funcLut_flags(get);
202
201
  if (funcFlags & 0b10) {
203
202
  // constructor func, add new.target, this args
204
203
  Porffor.wasm`
205
204
  f64.const 0
206
205
  i32.const 0
207
- local.get ${_this}
206
+ local.get ${obj}
208
207
  f64.convert_i32_u
209
- local.get ${_this+1}
208
+ local.get ${obj+1}
210
209
  local.get ${get}
211
210
  call_indirect 2 0
212
211
  return`;
@@ -228,7 +227,7 @@ i32.shr_u
228
227
  return`;
229
228
  };
230
229
 
231
- export const __Porffor_object_writeKey = (ptr: i32, key: any) => {
230
+ export const __Porffor_object_writeKey = (ptr: i32, key: any): void => {
232
231
  // encode key type
233
232
  let keyEnc: i32 = Porffor.wasm`local.get ${key}`;
234
233
 
@@ -241,22 +240,22 @@ export const __Porffor_object_writeKey = (ptr: i32, key: any) => {
241
240
  Porffor.wasm.i32.store(ptr, keyEnc, 0, 0);
242
241
  };
243
242
 
244
- export const __Porffor_object_set = (_this: object, key: any, value: any): any => {
245
- let entryPtr: i32 = __Porffor_object_lookup(_this, key);
243
+ export const __Porffor_object_set = (obj: object, key: any, value: any): any => {
244
+ let entryPtr: i32 = __Porffor_object_lookup(obj, key);
246
245
  let flags: i32;
247
246
  if (entryPtr == -1) {
248
247
  // add new entry
249
248
  // check if object is inextensible
250
- if (__Porffor_object_isInextensible(_this)) {
249
+ if (__Porffor_object_isInextensible(obj)) {
251
250
  return value;
252
251
  }
253
252
 
254
253
  // bump size +1
255
- const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
256
- Porffor.wasm.i32.store(_this, size + 1, 0, 0);
254
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
255
+ Porffor.wasm.i32.store(obj, size + 1, 0, 0);
257
256
 
258
257
  // entryPtr = current end of object
259
- entryPtr = Porffor.wasm`local.get ${_this}` + 5 + size * 14;
258
+ entryPtr = Porffor.wasm`local.get ${obj}` + 5 + size * 14;
260
259
 
261
260
  __Porffor_object_writeKey(entryPtr, key);
262
261
 
@@ -276,26 +275,26 @@ export const __Porffor_object_set = (_this: object, key: any, value: any): any =
276
275
  return value;
277
276
  }
278
277
 
279
- const funcFlags: i32 = Porffor.funcLut.flags(set);
280
- if (funcFlags & 0b10) {
281
- // constructor func, add new.target, this args
282
- Porffor.wasm`
283
- f64.const 0
284
- i32.const 0
285
- local.get ${_this}
286
- f64.convert_i32_u
287
- i32.const 7
288
- local.get ${value}
289
- local.get ${value+1}
290
- local.get ${set}
291
- call_indirect 3 0`;
292
- } else {
293
- Porffor.wasm`
294
- local.get ${value}
295
- local.get ${value+1}
296
- local.get ${set}
297
- call_indirect 1 0`;
298
- }
278
+ const funcFlags: i32 = __Porffor_funcLut_flags(set);
279
+ if (funcFlags & 0b10) {
280
+ // constructor func, add new.target, this args
281
+ Porffor.wasm`
282
+ f64.const 0
283
+ i32.const 0
284
+ local.get ${obj}
285
+ f64.convert_i32_u
286
+ i32.const 7
287
+ local.get ${value}
288
+ local.get ${value+1}
289
+ local.get ${set}
290
+ call_indirect 3 0`;
291
+ } else {
292
+ Porffor.wasm`
293
+ local.get ${value}
294
+ local.get ${value+1}
295
+ local.get ${set}
296
+ call_indirect 1 0`;
297
+ }
299
298
 
300
299
  return value;
301
300
  }
@@ -321,21 +320,21 @@ call_indirect 1 0`;
321
320
  return value;
322
321
  };
323
322
 
324
- export const __Porffor_object_define = (_this: object, key: any, value: any, flags: any): any => {
325
- let entryPtr: i32 = __Porffor_object_lookup(_this, key);
323
+ export const __Porffor_object_define = (obj: object, key: any, value: any, flags: i32): void => {
324
+ let entryPtr: i32 = __Porffor_object_lookup(obj, key);
326
325
  if (entryPtr == -1) {
327
326
  // add new entry
328
327
  // check if object is inextensible
329
- if (__Porffor_object_isInextensible(_this)) {
328
+ if (__Porffor_object_isInextensible(obj)) {
330
329
  throw new TypeError('Cannot define property, object is inextensible');
331
330
  }
332
331
 
333
332
  // bump size +1
334
- const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
335
- Porffor.wasm.i32.store(_this, size + 1, 0, 0);
333
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
334
+ Porffor.wasm.i32.store(obj, size + 1, 0, 0);
336
335
 
337
336
  // entryPtr = current end of object
338
- entryPtr = Porffor.wasm`local.get ${_this}` + 5 + size * 14;
337
+ entryPtr = Porffor.wasm`local.get ${obj}` + 5 + size * 14;
339
338
 
340
339
  __Porffor_object_writeKey(entryPtr, key);
341
340
  } else {
@@ -386,8 +385,8 @@ local.set ${err}`;
386
385
  0, 12);
387
386
  };
388
387
 
389
- export const __Porffor_object_delete = (_this: object, key: any): boolean => {
390
- const entryPtr: i32 = __Porffor_object_lookup(_this, key);
388
+ export const __Porffor_object_delete = (obj: object, key: any): boolean => {
389
+ const entryPtr: i32 = __Porffor_object_lookup(obj, key);
391
390
  if (entryPtr == -1) {
392
391
  // not found, stop
393
392
  return true;
@@ -400,11 +399,11 @@ export const __Porffor_object_delete = (_this: object, key: any): boolean => {
400
399
  return false;
401
400
  }
402
401
 
403
- const ind: i32 = (entryPtr - Porffor.wasm`local.get ${_this}`) / 14;
402
+ const ind: i32 = (entryPtr - Porffor.wasm`local.get ${obj}`) / 14;
404
403
 
405
404
  // decrement size
406
- let size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
407
- Porffor.wasm.i32.store(_this, --size, 0, 0);
405
+ let size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
406
+ Porffor.wasm.i32.store(obj, --size, 0, 0);
408
407
 
409
408
  if (size > ind) {
410
409
  // offset all elements after by -1 ind
@@ -459,16 +458,16 @@ export const __Porffor_object_isObjectOrSymbol = (arg: any): boolean => {
459
458
 
460
459
 
461
460
  // used for { foo: 5 }
462
- export const __Porffor_object_expr_init = (_this: object, key: any, value: any): void => {
463
- let entryPtr: i32 = __Porffor_object_lookup(_this, key);
461
+ export const __Porffor_object_expr_init = (obj: object, key: any, value: any): void => {
462
+ let entryPtr: i32 = __Porffor_object_lookup(obj, key);
464
463
  if (entryPtr == -1) {
465
464
  // add new entry
466
465
  // bump size +1
467
- const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
468
- Porffor.wasm.i32.store(_this, size + 1, 0, 0);
466
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
467
+ Porffor.wasm.i32.store(obj, size + 1, 0, 0);
469
468
 
470
469
  // entryPtr = current end of object
471
- entryPtr = Porffor.wasm`local.get ${_this}` + 5 + size * 14;
470
+ entryPtr = Porffor.wasm`local.get ${obj}` + 5 + size * 14;
472
471
 
473
472
  __Porffor_object_writeKey(entryPtr, key);
474
473
  }
@@ -484,17 +483,17 @@ export const __Porffor_object_expr_init = (_this: object, key: any, value: any):
484
483
  };
485
484
 
486
485
  // used for { get foo() {} }
487
- export const __Porffor_object_expr_get = (_this: object, key: any, get: any): void => {
488
- let entryPtr: i32 = __Porffor_object_lookup(_this, key);
486
+ export const __Porffor_object_expr_get = (obj: object, key: any, get: any): void => {
487
+ let entryPtr: i32 = __Porffor_object_lookup(obj, key);
489
488
  let set: any = undefined;
490
489
  if (entryPtr == -1) {
491
490
  // add new entry
492
491
  // bump size +1
493
- const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
494
- Porffor.wasm.i32.store(_this, size + 1, 0, 0);
492
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
493
+ Porffor.wasm.i32.store(obj, size + 1, 0, 0);
495
494
 
496
495
  // entryPtr = current end of object
497
- entryPtr = Porffor.wasm`local.get ${_this}` + 5 + size * 14;
496
+ entryPtr = Porffor.wasm`local.get ${obj}` + 5 + size * 14;
498
497
 
499
498
  __Porffor_object_writeKey(entryPtr, key);
500
499
  } else {
@@ -513,17 +512,17 @@ export const __Porffor_object_expr_get = (_this: object, key: any, get: any): vo
513
512
  };
514
513
 
515
514
  // used for { set foo(v) {} }
516
- export const __Porffor_object_expr_set = (_this: object, key: any, set: any): void => {
517
- let entryPtr: i32 = __Porffor_object_lookup(_this, key);
515
+ export const __Porffor_object_expr_set = (obj: object, key: any, set: any): void => {
516
+ let entryPtr: i32 = __Porffor_object_lookup(obj, key);
518
517
  let get: any = undefined;
519
518
  if (entryPtr == -1) {
520
519
  // add new entry
521
520
  // bump size +1
522
- const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
523
- Porffor.wasm.i32.store(_this, size + 1, 0, 0);
521
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
522
+ Porffor.wasm.i32.store(obj, size + 1, 0, 0);
524
523
 
525
524
  // entryPtr = current end of object
526
- entryPtr = Porffor.wasm`local.get ${_this}` + 5 + size * 14;
525
+ entryPtr = Porffor.wasm`local.get ${obj}` + 5 + size * 14;
527
526
 
528
527
  __Porffor_object_writeKey(entryPtr, key);
529
528
  } else {
@@ -36,10 +36,10 @@ export const __Array_from = (arg: any, mapFn: any): any[] => {
36
36
  return out;
37
37
  };
38
38
 
39
- export const __Porffor_fastPush = (_this: any[], el: any) => {
40
- let len: i32 = _this.length;
41
- _this[len] = el;
42
- _this.length = ++len;
39
+ export const __Porffor_array_fastPush = (arr: any[], el: any): i32 => {
40
+ let len: i32 = arr.length;
41
+ arr[len] = el;
42
+ arr.length = ++len;
43
43
  return len;
44
44
  };
45
45
 
@@ -26,9 +26,53 @@ type PorfforGlobal = {
26
26
  allocateBytes(bytes: i32): any;
27
27
 
28
28
  set: {
29
- read(_this: any, index: number): i32;
30
- write(_this: any, index: number, value: any): boolean;
31
- indexOf(_this: any, value: any): i32;
29
+ read(ptr: any, index: number): i32;
30
+ write(ptr: any, index: number, value: any): boolean;
31
+ }
32
+
33
+ array: {
34
+ fastPush(arr: any[], el: any): i32;
35
+ }
36
+
37
+ arraybuffer: {
38
+ detach(buffer: any): void;
39
+ }
40
+
41
+ object: {
42
+ preventExtensions(obj: object): void;
43
+ isInextensible(obj: object): boolean;
44
+
45
+ overrideAllFlags(obj: object, overrideOr: i32, overrideAnd: i32): void;
46
+ checkAllFlags(obj: object, dataAnd: i32, accessorAnd: i32, dataExpected: i32, accessorExpected: i32): boolean;
47
+
48
+ packAccessor(get: any, set: any): f64;
49
+ accessorGet(entryPtr: i32): Function;
50
+ accessorSet(entryPtr: i32): Function;
51
+
52
+ lookup(obj: object, target: any): i32;
53
+ get(obj: any, key: any): any;
54
+
55
+ writeKey(ptr: i32, key: any): void;
56
+ set(obj: object, key: any, value: any): any;
57
+ define(obj: object, key: any, value: any, flags: i32): void;
58
+ delete(obj: object, key: any): boolean;
59
+
60
+ isEnumerable(entryPtr: i32): boolean;
61
+
62
+ isObject(arg: any): boolean;
63
+ isObjectOrSymbol(arg: any): boolean;
64
+
65
+ expr: {
66
+ init(obj: object, key: any, value: any): void;
67
+ get(obj: object, key: any, value: any): void;
68
+ set(obj: object, key: any, value: any): void;
69
+ }
70
+ }
71
+
72
+ funcLut: {
73
+ flags(func: Function): i32;
74
+ length(func: Function): i32;
75
+ name(func: Function): bytestring;
32
76
  }
33
77
 
34
78
  bytestring: {
@@ -10,7 +10,7 @@ export const __ecma262_NewPromiseReactionJob = (reaction: any[], argument: any):
10
10
 
11
11
  const jobQueue: any[] = new Array(0);
12
12
  export const __ecma262_HostEnqueuePromiseJob = (job: any[]): void => {
13
- Porffor.fastPush(jobQueue, job);
13
+ Porffor.array.fastPush(jobQueue, job);
14
14
  };
15
15
 
16
16
  // 27.2.1.8 TriggerPromiseReactions (reactions, argument)
@@ -241,11 +241,11 @@ export const __Promise_prototype_then = (_this: any, onFulfilled: any, onRejecte
241
241
  if (state == 0) { // pending
242
242
  // a. Append fulfillReaction to promise.[[PromiseFulfillReactions]].
243
243
  const fulfillReactions: any[] = promise[2];
244
- Porffor.fastPush(fulfillReactions, fulfillReaction);
244
+ Porffor.array.fastPush(fulfillReactions, fulfillReaction);
245
245
 
246
246
  // b. Append rejectReaction to promise.[[PromiseRejectReactions]].
247
247
  const rejectReactions: any[] = promise[3];
248
- Porffor.fastPush(rejectReactions, rejectReaction);
248
+ Porffor.array.fastPush(rejectReactions, rejectReaction);
249
249
  } else if (state == 1) { // fulfilled
250
250
  // 10. Else if promise.[[PromiseState]] is fulfilled, then
251
251
  // a. Let value be promise.[[PromiseResult]].
@@ -297,10 +297,10 @@ export const __Promise_prototype_finally = (_this: any, onFinally: any): Promise
297
297
 
298
298
  if (state == 0) { // pending
299
299
  const fulfillReactions: any[] = promise[2];
300
- Porffor.fastPush(fulfillReactions, finallyReaction);
300
+ Porffor.array.fastPush(fulfillReactions, finallyReaction);
301
301
 
302
302
  const rejectReactions: any[] = promise[3];
303
- Porffor.fastPush(rejectReactions, finallyReaction);
303
+ Porffor.array.fastPush(rejectReactions, finallyReaction);
304
304
  } else { // fulfilled or rejected
305
305
  const value: any = promise[0];
306
306
  __ecma262_HostEnqueuePromiseJob(__ecma262_NewPromiseReactionJob(finallyReaction, value));
@@ -330,12 +330,12 @@ export const __Promise_all = (promises: any): Promise => {
330
330
  _allLen++;
331
331
  if (__ecma262_IsPromise(x)) {
332
332
  x.then(r => {
333
- if (Porffor.fastPush(_allOut, r) == _allLen) _allRes(_allOut);
333
+ if (Porffor.array.fastPush(_allOut, r) == _allLen) _allRes(_allOut);
334
334
  }, r => {
335
335
  _allRej(r);
336
336
  });
337
337
  } else {
338
- Porffor.fastPush(_allOut, x);
338
+ Porffor.array.fastPush(_allOut, x);
339
339
  }
340
340
  }
341
341
 
@@ -373,7 +373,7 @@ export const __Promise_allSettled = (promises: any): Promise => {
373
373
  o.status = status;
374
374
 
375
375
  o.value = r;
376
- if (Porffor.fastPush(_allOut, o) == _allLen) _allRes(_allOut);
376
+ if (Porffor.array.fastPush(_allOut, o) == _allLen) _allRes(_allOut);
377
377
  }, r => {
378
378
  const o = {};
379
379
  let status: bytestring = '';
@@ -381,7 +381,7 @@ export const __Promise_allSettled = (promises: any): Promise => {
381
381
  o.status = status;
382
382
 
383
383
  o.reason = r;
384
- if (Porffor.fastPush(_allOut, o) == _allLen) _allRes(_allOut);
384
+ if (Porffor.array.fastPush(_allOut, o) == _allLen) _allRes(_allOut);
385
385
  });
386
386
  } else {
387
387
  const o = {};
@@ -390,7 +390,7 @@ export const __Promise_allSettled = (promises: any): Promise => {
390
390
  o.status = status;
391
391
 
392
392
  o.value = x;
393
- Porffor.fastPush(_allOut, o);
393
+ Porffor.array.fastPush(_allOut, o);
394
394
  }
395
395
  }
396
396
 
@@ -1,14 +1,14 @@
1
1
  import type {} from './porffor.d.ts';
2
2
 
3
3
  // dark wasm magic for dealing with memory, sorry.
4
- export const __Porffor_set_read = (_this: Set, index: number): any => {
4
+ export const __Porffor_set_read = (set: Set, index: number): any => {
5
5
  Porffor.wasm`
6
6
  local offset i32
7
7
  local.get ${index}
8
8
  i32.to_u
9
9
  i32.const 9
10
10
  i32.mul
11
- local.get ${_this}
11
+ local.get ${set}
12
12
  i32.to_u
13
13
  i32.add
14
14
  local.set offset
@@ -21,14 +21,14 @@ i32.load8_u 0 12
21
21
  return`;
22
22
  };
23
23
 
24
- export const __Porffor_set_write = (_this: Set, index: number, value: any): boolean => {
24
+ export const __Porffor_set_write = (set: Set, index: number, value: any): boolean => {
25
25
  Porffor.wasm`
26
26
  local offset i32
27
27
  local.get ${index}
28
28
  i32.to_u
29
29
  i32.const 9
30
30
  i32.mul
31
- local.get ${_this}
31
+ local.get ${set}
32
32
  i32.to_u
33
33
  i32.add
34
34
  local.set offset
@@ -44,15 +44,6 @@ i32.store8 0 12`;
44
44
  return true;
45
45
  };
46
46
 
47
- export const __Porffor_set_indexOf = (_this: Set, value: any): i32 => {
48
- const size: i32 = Porffor.wasm.i32.load(_this, 0, 0);
49
- for (let i: i32 = 0; i < size; i++) {
50
- if (Porffor.set.read(_this, i) === value) return i;
51
- }
52
-
53
- return -1;
54
- };
55
-
56
47
 
57
48
  export const __Set_prototype_size$get = (_this: Set) => {
58
49
  return Porffor.wasm.i32.load(_this, 0, 0);
@@ -65,7 +56,7 @@ export const __Set_prototype_values = (_this: Set) => {
65
56
  const out: any[] = __Porffor_allocate();
66
57
  for (let i: number = 0; i < size; i++) {
67
58
  const val: any = __Porffor_set_read(_this, i);
68
- Porffor.fastPush(out, val);
59
+ Porffor.array.fastPush(out, val);
69
60
  }
70
61
 
71
62
  return out;
@@ -17,7 +17,7 @@ export const Symbol = (description: any): Symbol => {
17
17
  }
18
18
 
19
19
  // 4. Return a new Symbol whose [[Description]] is descString.
20
- const sym: Symbol = Porffor.fastPush(descStore, descString);
20
+ const sym: Symbol = Porffor.array.fastPush(descStore, descString);
21
21
  return sym;
22
22
  };
23
23
 
@@ -110,7 +110,7 @@ export const __Map_prototype_keys = (_this: Map) => {
110
110
  const out: any[] = Porffor.allocate();
111
111
 
112
112
  for (const x of keys) {
113
- Porffor.fastPush(out, x);
113
+ Porffor.array.fastPush(out, x);
114
114
  }
115
115
 
116
116
  return out;
@@ -122,7 +122,7 @@ export const __Map_prototype_values = (_this: Map) => {
122
122
  const out: any[] = Porffor.allocate();
123
123
 
124
124
  for (let i: i32 = 0; i < size; i++) {
125
- Porffor.fastPush(out, vals[i]);
125
+ Porffor.array.fastPush(out, vals[i]);
126
126
  }
127
127
 
128
128
  return out;