porffor 0.42.0 → 0.42.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.
@@ -128,12 +128,13 @@ export default (funcs, globals, tags, pages, data, noTreeshake = false) => {
128
128
  );
129
129
  time('table section');
130
130
 
131
+ const emptyWrapperFunc = funcs.find(x => x.name === '#indirect#empty');
131
132
  const elementSection = !funcs.table ? [] : createSection(
132
133
  Section.element,
133
134
  encodeVector([ [
134
135
  0x00,
135
136
  Opcodes.i32_const, 0, Opcodes.end,
136
- ...encodeVector(directFuncs.map(x => unsignedLEB128((x.wrapperFunc ?? x).asmIndex)))
137
+ ...encodeVector(directFuncs.map(x => unsignedLEB128((x.wrapperFunc ?? emptyWrapperFunc ?? x).asmIndex)))
137
138
  ] ])
138
139
  );
139
140
  time('element section');
@@ -189,7 +189,6 @@ export const Promise = function (executor: any): void {
189
189
  if (Porffor.rawType(executor) != Porffor.TYPES.function) throw new TypeError('Promise executor is not a function');
190
190
 
191
191
  const obj: any[] = __Porffor_promise_create();
192
-
193
192
  activePromise = obj;
194
193
 
195
194
  try {
@@ -203,6 +202,20 @@ export const Promise = function (executor: any): void {
203
202
  return pro;
204
203
  };
205
204
 
205
+ export const __Promise_withResolvers = (): Promise => {
206
+ const obj: any[] = __Porffor_promise_create();
207
+ activePromise = obj;
208
+
209
+ const promise: Promise = obj;
210
+ const out: object = Porffor.allocate();
211
+ out.promise = promise;
212
+
213
+ out.resolve = __Porffor_promise_resolveActive;
214
+ out.reject = __Porffor_promise_rejectActive;
215
+
216
+ return out;
217
+ };
218
+
206
219
  export const __Promise_resolve = (value: any): Promise => {
207
220
  const obj: any[] = __Porffor_promise_create();
208
221