porffor 0.18.43 → 0.19.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/set.ts
CHANGED
@@ -173,6 +173,12 @@ export const __Set_prototype_clear = (_this: Set) => {
|
|
173
173
|
Porffor.wasm.i32.store(_this, 0, 0, 0);
|
174
174
|
};
|
175
175
|
|
176
|
+
export const __Set_prototype_forEach = (_this: Set, callbackFn: any) => {
|
177
|
+
for (const x of _this) {
|
178
|
+
callbackFn(x, x, _this);
|
179
|
+
}
|
180
|
+
};
|
181
|
+
|
176
182
|
export const Set = function (iterable: any): Set {
|
177
183
|
if (!new.target) throw new TypeError("Constructor Set requires 'new'");
|
178
184
|
|
@@ -55,7 +55,7 @@ export const __Map_prototype_delete = (_this: Map, key: any) => {
|
|
55
55
|
const keyIdx = Porffor.set.indexOf(keys, key);
|
56
56
|
if (keyIdx == -1) return false;
|
57
57
|
|
58
|
-
__Set_prototype_delete(key);
|
58
|
+
__Set_prototype_delete(keys, key);
|
59
59
|
|
60
60
|
const vals: any[] = Porffor.wasm.i32.load(_this, 0, 4);
|
61
61
|
__Array_prototype_splice(keyIdx, 1);
|
@@ -81,4 +81,26 @@ export const __Map_prototype_forEach = (_this: Map, callbackFn: any) => {
|
|
81
81
|
while (i < size) {
|
82
82
|
callbackFn(vals[i], Porffor.set.read(keys, i++), _this);
|
83
83
|
}
|
84
|
+
};
|
85
|
+
|
86
|
+
export const __Map_prototype_keys = (_this: Map) => {
|
87
|
+
const keys: Set = Porffor.wasm.i32.load(_this, 0, 0);
|
88
|
+
const out: any[] = Porffor.allocate();
|
89
|
+
|
90
|
+
for (const x of keys) {
|
91
|
+
out.push(x);
|
92
|
+
}
|
93
|
+
|
94
|
+
return out;
|
95
|
+
};
|
96
|
+
|
97
|
+
export const __Map_prototype_values = (_this: Map) => {
|
98
|
+
const vals: Set = Porffor.wasm.i32.load(_this, 0, 4);
|
99
|
+
const out: any[] = Porffor.allocate();
|
100
|
+
|
101
|
+
for (const x of vals) {
|
102
|
+
out.push(x);
|
103
|
+
}
|
104
|
+
|
105
|
+
return out;
|
84
106
|
};
|
@@ -1530,6 +1530,13 @@ export const BuiltinFuncs = function() {
|
|
1530
1530
|
returns: [124,127], typedReturns: 1,
|
1531
1531
|
locals: [], localNames: ["_this","_this#type"],
|
1532
1532
|
};
|
1533
|
+
this.__Set_prototype_forEach = {
|
1534
|
+
wasm: (scope, {internalThrow}) => [[32,0],[252,3],[33,4],[65,0],[33,6],[32,4],[40,1,0],[33,5],[3,64],[32,4],[43,0,4],[32,4],[45,0,12],[33,8],[33,7],[2,64],[2,64],[32,3],[33,18],[2,124],[32,18],[65,5],[70],[4,64,"TYPESWITCH|Function"],[32,7],[32,8],[33,9],[33,10],[32,7],[32,8],[33,11],[33,12],[32,0],[65,19],[33,13],[33,14],[32,2],[252,3],[34,15],[65,3],[108],[65,2],[106],[45,0,128,128,4,"read func lut"],[34,16],[65,2],[113],[69],[65,0],[113],[4,64],...internalThrow(scope, 'TypeError', `callbackFn is not a constructor`),[11],[2,124],[2,64],[2,64],[2,64],[2,64],[32,15],[65,3],[108],[47,0,128,128,4,"read func lut"],[14,4,0,1,2,3,0],[11],[32,16],[65,1],[113],[4,124],[32,16],[65,2],[113],[4,124],[65,0],[32,15],[17,0,0,"no_type_return","constr"],[5],[32,15],[17,0,0,"no_type_return"],[11],[5],[32,16],[65,2],[113],[4,124],[65,0],[32,15],[17,0,0,"constr"],[26],[5],[32,15],[17,0,0],[26],[11],[11],[12,3],[11],[32,16],[65,1],[113],[4,124],[32,16],[65,2],[113],[4,124],[65,0],[32,10],[32,9],[32,15],[17,1,0,"no_type_return","constr"],[5],[32,10],[32,9],[32,15],[17,1,0,"no_type_return"],[11],[5],[32,16],[65,2],[113],[4,124],[65,0],[32,10],[32,9],[32,15],[17,1,0,"constr"],[26],[5],[32,10],[32,9],[32,15],[17,1,0],[26],[11],[11],[12,2],[11],[32,16],[65,1],[113],[4,124],[32,16],[65,2],[113],[4,124],[65,0],[32,10],[32,9],[32,12],[32,11],[32,15],[17,2,0,"no_type_return","constr"],[5],[32,10],[32,9],[32,12],[32,11],[32,15],[17,2,0,"no_type_return"],[11],[5],[32,16],[65,2],[113],[4,124],[65,0],[32,10],[32,9],[32,12],[32,11],[32,15],[17,2,0,"constr"],[26],[5],[32,10],[32,9],[32,12],[32,11],[32,15],[17,2,0],[26],[11],[11],[12,1],[11],[32,16],[65,1],[113],[4,124],[32,16],[65,2],[113],[4,124],[65,0],[32,10],[32,9],[32,12],[32,11],[32,14],[32,13],[32,15],[17,3,0,"no_type_return","constr"],[5],[32,10],[32,9],[32,12],[32,11],[32,14],[32,13],[32,15],[17,3,0,"no_type_return"],[11],[5],[32,16],[65,2],[113],[4,124],[65,0],[32,10],[32,9],[32,12],[32,11],[32,14],[32,13],[32,15],[17,3,0,"constr"],[26],[5],[32,10],[32,9],[32,12],[32,11],[32,14],[32,13],[32,15],[17,3,0],[26],[11],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `callbackFn is not a function`),[68,0,0,0,0,0,0,0,0],[11,"TYPESWITCH_end"],[26],[11],[32,4],[65,9],[106],[33,4],[32,6],[65,1],[106],[34,6],[32,5],[71],[13,1],[11],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
1535
|
+
params: [124,127,124,127], typedParams: 1,
|
1536
|
+
returns: [124,127], typedReturns: 1,
|
1537
|
+
locals: [127,127,127,124,127,127,124,127,124,127,124,127,127,127,127], localNames: ["_this","_this#type","callbackFn","callbackFn#type","forof_base_pointer","forof_length","forof_counter","x","x#type","#indirect_arg0_type","#indirect_arg0_val","#indirect_arg1_type","#indirect_arg1_val","#indirect_arg2_type","#indirect_arg2_val","#indirect_func","#indirect_flags","#last_type","#typeswitch_tmp"],
|
1538
|
+
table: 1,
|
1539
|
+
};
|
1533
1540
|
this.Set = {
|
1534
1541
|
wasm: (scope, {builtin,internalThrow}) => [[32,-1],[184],[65,1],[33,2],[33,3],[32,2],[33,4],[2,124],[32,4],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,4],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,3],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,3],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Constructor Set requires 'new'`),[11],[16, builtin('__Porffor_allocate')],[33,2],[33,5],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[4,64],[32,0],[252,3],[33,6],[65,0],[33,8],[32,6],[40,1,0],[33,7],[32,1],[33,4],[2,64],[32,4],[65,19],[70],[4,64,"TYPESWITCH|Set"],[3,64],[32,6],[43,0,4],[32,6],[45,0,12],[33,10],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,6],[65,9],[106],[33,6],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,194,0],[70],[4,64,"TYPESWITCH|String"],[65,194,0],[33,10],[65,0],[65,1],[54,0,0],[3,64],[65,0],[32,6],[47,0,4],[59,0,4],[68,0,0,0,0,0,0,0,0],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,6],[65,2],[106],[33,6],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[3,64],[32,6],[43,0,4],[32,6],[45,0,12],[33,10],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,6],[65,9],[106],[33,6],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[65,0],[33,10],[3,64],[32,6],[40,0,4],[32,8],[106],[45,0,4],[184],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[65,0],[33,10],[3,64],[32,6],[40,0,4],[32,8],[106],[44,0,4],[183],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[65,0],[33,10],[3,64],[32,6],[40,0,4],[32,8],[106],[45,0,4],[184],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[65,0],[33,10],[3,64],[32,6],[40,0,4],[32,8],[65,2],[108],[106],[47,0,4],[184],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[65,0],[33,10],[3,64],[32,6],[40,0,4],[32,8],[65,2],[108],[106],[46,0,4],[183],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[65,0],[33,10],[3,64],[32,6],[40,0,4],[32,8],[65,4],[108],[106],[40,0,4],[184],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[65,0],[33,10],[3,64],[32,6],[40,0,4],[32,8],[65,4],[108],[106],[40,0,4],[183],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[65,0],[33,10],[3,64],[32,6],[40,0,4],[32,8],[65,4],[108],[106],[42,0,4],[187],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[65,0],[33,10],[3,64],[32,6],[40,0,4],[32,8],[65,8],[108],[106],[43,0,4],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],[32,4],[65,194,1],[70],[4,64,"TYPESWITCH|ByteString"],[65,194,1],[33,10],[65,0],[65,1],[54,0,0],[3,64],[65,0],[32,6],[32,8],[106],[45,0,4],[58,0,4],[68,0,0,0,0,0,0,0,0],[33,9],[2,64],[32,5],[65,19],[32,9],[32,10],[16, builtin('__Set_prototype_add')],[33,2],[26],[32,8],[65,1],[106],[34,8],[32,7],[71],[13,1],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `Tried for..of on non-iterable type`),[11,"TYPESWITCH_end"],[11],[32,5],[65,19],[15]],
|
1535
1542
|
params: [124,127], typedParams: 1,
|
@@ -4054,7 +4061,7 @@ export const BuiltinFuncs = function() {
|
|
4054
4061
|
locals: [124,124,124,124,127,124,127], localNames: ["_this","_this#type","key","key#type","value","value#type","keys","vals","size","keyIdx","#last_type","#member_setter_val_tmp","#member_setter_ptr_tmp"],
|
4055
4062
|
};
|
4056
4063
|
this.__Map_prototype_delete = {
|
4057
|
-
wasm: (scope, {builtin}) => [[32,0],[252,2],[40,0,0],[183],[34,4],[65,19],[32,2],[32,3],[16, builtin('__Porffor_set_indexOf')],[33,7],[33,5],[32,7],[33,6],[32,5],[68,0,0,0,0,0,0,240,191],[97],[4,64],[68,0,0,0,0,0,0,0,0],[65,1],[15],[11],[32,
|
4064
|
+
wasm: (scope, {builtin}) => [[32,0],[252,2],[40,0,0],[183],[34,4],[65,19],[32,2],[32,3],[16, builtin('__Porffor_set_indexOf')],[33,7],[33,5],[32,7],[33,6],[32,5],[68,0,0,0,0,0,0,240,191],[97],[4,64],[68,0,0,0,0,0,0,0,0],[65,1],[15],[11],[32,4],[65,19],[32,2],[32,3],[16, builtin('__Set_prototype_delete')],[33,7],[26],[32,0],[252,2],[40,0,4],[183],[33,8],[32,5],[32,6],[68,0,0,0,0,0,0,240,63],[65,0],[68,0,0,0,0,0,0,0,0],[65,3],[65,4],[65,0],[54,1,0],[68,0,0,0,0,0,0,16,64],[65,208,0],[16, builtin('__Array_prototype_splice')],[33,7],[26],[68,0,0,0,0,0,0,240,63],[65,1],[15]],
|
4058
4065
|
params: [124,127,124,127], typedParams: 1,
|
4059
4066
|
returns: [124,127], typedReturns: 1,
|
4060
4067
|
locals: [124,124,127,127,124], localNames: ["_this","_this#type","key","key#type","keys","keyIdx","keyIdx#type","#last_type","vals"],
|
@@ -4072,4 +4079,16 @@ export const BuiltinFuncs = function() {
|
|
4072
4079
|
locals: [124,124,124,124,127,127,127,124,127,124,127,124,127,127,127], localNames: ["_this","_this#type","callbackFn","callbackFn#type","keys","vals","size","i","#loadArray_offset","#last_type","#indirect_arg0_type","#indirect_arg0_val","#indirect_arg1_type","#indirect_arg1_val","#indirect_arg2_type","#indirect_arg2_val","#indirect_func","#indirect_flags","#typeswitch_tmp"],
|
4073
4080
|
table: 1,
|
4074
4081
|
};
|
4082
|
+
this.__Map_prototype_keys = {
|
4083
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,0],[183],[33,2],[16, builtin('__Porffor_allocate')],[33,4],[33,3],[32,2],[252,3],[33,5],[65,0],[33,7],[32,5],[40,1,0],[33,6],[3,64],[32,5],[43,0,4],[32,5],[45,0,12],[33,9],[33,8],[2,64],[2,64],[32,3],[33,10],[65,208,0],[34,11],[33,12],[2,124],[32,12],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,10],[32,11],[65,128,128,20],[65,1],[54,1,0],[65,128,128,20],[32,8],[57,0,4],[65,128,128,20],[32,9],[58,0,12],[68,0,0,0,0,0,0,20,65],[65,208,0],[16, builtin('__Array_prototype_push')],[33,4],[12,1],[11],...internalThrow(scope, 'TypeError', `'push' proto func tried to be called on a type without an impl`),[11,"TYPESWITCH_end"],[26],[11],[32,5],[65,9],[106],[33,5],[32,7],[65,1],[106],[34,7],[32,6],[71],[13,1],[11],[11],[32,3],[65,208,0],[15]],
|
4084
|
+
params: [124,127], typedParams: 1,
|
4085
|
+
returns: [124,127], typedReturns: 1,
|
4086
|
+
locals: [124,124,127,127,127,127,124,127,124,127,127], localNames: ["_this","_this#type","keys","out","#last_type","forof_base_pointer","forof_length","forof_counter","x","x#type","#proto_target","#proto_target#type","#typeswitch_tmp"],
|
4087
|
+
};
|
4088
|
+
this.__Map_prototype_values = {
|
4089
|
+
wasm: (scope, {builtin,internalThrow}) => [[32,0],[252,2],[40,0,4],[183],[33,2],[16, builtin('__Porffor_allocate')],[33,4],[33,3],[32,2],[252,3],[33,5],[65,0],[33,7],[32,5],[40,1,0],[33,6],[3,64],[32,5],[43,0,4],[32,5],[45,0,12],[33,9],[33,8],[2,64],[2,64],[32,3],[33,10],[65,208,0],[34,11],[33,12],[2,124],[32,12],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[32,10],[32,11],[65,128,128,40],[65,1],[54,1,0],[65,128,128,40],[32,8],[57,0,4],[65,128,128,40],[32,9],[58,0,12],[68,0,0,0,0,0,0,36,65],[65,208,0],[16, builtin('__Array_prototype_push')],[33,4],[12,1],[11],...internalThrow(scope, 'TypeError', `'push' proto func tried to be called on a type without an impl`),[11,"TYPESWITCH_end"],[26],[11],[32,5],[65,9],[106],[33,5],[32,7],[65,1],[106],[34,7],[32,6],[71],[13,1],[11],[11],[32,3],[65,208,0],[15]],
|
4090
|
+
params: [124,127], typedParams: 1,
|
4091
|
+
returns: [124,127], typedReturns: 1,
|
4092
|
+
locals: [124,124,127,127,127,127,124,127,124,127,127], localNames: ["_this","_this#type","vals","out","#last_type","forof_base_pointer","forof_length","forof_counter","x","x#type","#proto_target","#proto_target#type","#typeswitch_tmp"],
|
4093
|
+
};
|
4075
4094
|
};
|
package/package.json
CHANGED