porffor 0.20.4 → 0.20.5
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/assemble.js
CHANGED
@@ -146,7 +146,7 @@ export default (funcs, globals, tags, pages, data, flags, noTreeshake = false) =
|
|
146
146
|
|
147
147
|
const tableSection = !funcs.table ? [] : createSection(
|
148
148
|
Section.table,
|
149
|
-
encodeVector([ [ Reftype.funcref, 0x00, funcs.length ] ])
|
149
|
+
encodeVector([ [ Reftype.funcref, 0x00, ...unsignedLEB128(funcs.length) ] ])
|
150
150
|
);
|
151
151
|
|
152
152
|
const elementSection = !funcs.table ? [] : createSection(
|
@@ -42,13 +42,11 @@ export const __Symbol_prototype_toString = (_this: Symbol) => {
|
|
42
42
|
Porffor.wasm.i32.store8(out, 108, 0, 9);
|
43
43
|
Porffor.wasm.i32.store8(out, 40, 0, 10);
|
44
44
|
|
45
|
-
const description: any =
|
45
|
+
const description: any = _this.description;
|
46
46
|
let descLen: i32 = 0;
|
47
47
|
if (description !== undefined) {
|
48
48
|
descLen = description.length;
|
49
49
|
|
50
|
-
print(descLen);
|
51
|
-
|
52
50
|
// todo: support regular string
|
53
51
|
let outPtr: i32 = Porffor.wasm`local.get ${out}` + 7;
|
54
52
|
let descPtr: i32 = Porffor.wasm`local.get ${description}`;
|
@@ -80,4 +78,16 @@ export const __Symbol_for = (key: any): Symbol => {
|
|
80
78
|
forStore.set(key, out);
|
81
79
|
|
82
80
|
return out;
|
81
|
+
};
|
82
|
+
|
83
|
+
export const __Symbol_keyFor = (arg: any): any => {
|
84
|
+
if (Porffor.rawType(arg) != Porffor.TYPES.symbol) throw new TypeError('Symbol.keyFor argument should be a Symbol');
|
85
|
+
|
86
|
+
const sym: Symbol = arg;
|
87
|
+
const desc: any = sym.description;
|
88
|
+
|
89
|
+
const stored: Symbol = forStore.get(desc);
|
90
|
+
if (sym == stored) return desc;
|
91
|
+
|
92
|
+
return undefined;
|
83
93
|
};
|
@@ -2084,11 +2084,10 @@ export const BuiltinFuncs = function() {
|
|
2084
2084
|
globalInits: {descStore: (scope, {allocPage,glbl,loc}) => [...number(allocPage(scope, 'array: symbol.ts/descStore', 'f64') * pageSize, 124),...glbl(36, 'descStore', 124),...glbl(35, 'descStore', 124),[252,3],[33,loc('#makearray_pointer_tmp', 127)],[32,loc('#makearray_pointer_tmp', 127)],[65,0],[54,1,0],[32,loc('#makearray_pointer_tmp', 127)],[68,0,0,0,0,0,0,0,0],[252,3],[54,1,0],[32,loc('#makearray_pointer_tmp', 127)],[26]],forStore: (scope, {glbl,builtin}) => [[65,1],[68,0,0,0,0,0,0,0,0],[65,128,1],[16, ...builtin('Map')],[26],...glbl(36, 'forStore', 124)]},
|
2085
2085
|
};
|
2086
2086
|
this.__Symbol_prototype_toString = {
|
2087
|
-
wasm: (scope, {
|
2087
|
+
wasm: (scope, {builtin}) => [[16, ...builtin('__Porffor_allocate')],[26],[34,2],[252,2],[65,211,0],[58,0,4],[32,2],[252,2],[65,249,0],[58,0,5],[32,2],[252,2],[65,237,0],[58,0,6],[32,2],[252,2],[65,226,0],[58,0,7],[32,2],[252,2],[65,239,0],[58,0,8],[32,2],[252,2],[65,236,0],[58,0,9],[32,2],[252,2],[65,40],[58,0,10],[32,0],[65,7],[16, ...builtin('__Symbol_prototype_description$get')],[33,5],[33,4],[68,0,0,0,0,0,0,0,0],[33,6],[32,4],[68,0,0,0,0,0,0,0,0],[98],[32,5],[65,128,1],[114],[65,128,1],[65,128,1],[114],[71],[114],[4,64],[32,4],[252,3],[40,1,0],[184],[33,6],[32,2],[68,0,0,0,0,0,0,28,64],[160],[33,7],[32,4],[34,8],[32,6],[160],[33,9],[3,64],[32,8],[32,9],[99],[4,64],[32,7],[32,7],[68,0,0,0,0,0,0,240,63],[160],[33,7],[252,2],[32,8],[32,8],[68,0,0,0,0,0,0,240,63],[160],[33,8],[252,2],[45,0,4],[58,0,4],[12,1],[11],[11],[11],[32,2],[32,6],[160],[252,2],[65,41],[58,0,11],[32,2],[252,3],[68,0,0,0,0,0,0,32,64],[32,6],[160],[34,10],[252,3],[54,1,0],[32,2],[65,195,1],[15]],
|
2088
2088
|
params: [124,127], typedParams: 1,
|
2089
2089
|
returns: [124,127], typedReturns: 1,
|
2090
|
-
locals: [124,127,124,127,124,124,
|
2091
|
-
globalInits: {descStore: (scope, {allocPage,glbl,loc}) => [...number(allocPage(scope, 'array: symbol.ts/descStore', 'f64') * pageSize, 124),...glbl(36, 'descStore', 124),...glbl(35, 'descStore', 124),[252,3],[33,loc('#makearray_pointer_tmp', 127)],[32,loc('#makearray_pointer_tmp', 127)],[65,0],[54,1,0],[32,loc('#makearray_pointer_tmp', 127)],[68,0,0,0,0,0,0,0,0],[252,3],[54,1,0],[32,loc('#makearray_pointer_tmp', 127)],[26]],forStore: (scope, {glbl,builtin}) => [[65,1],[68,0,0,0,0,0,0,0,0],[65,128,1],[16, ...builtin('Map')],[26],...glbl(36, 'forStore', 124)]},
|
2090
|
+
locals: [124,127,124,127,124,124,124,124,124], localNames: ["_this","_this#type","out","#last_type","description","description#type","descLen","outPtr","descPtr","descPtrEnd","__length_setter_tmp"],
|
2092
2091
|
};
|
2093
2092
|
this.__Symbol_prototype_toLocaleString = {
|
2094
2093
|
wasm: (scope, {builtin}) => [[32,0],[65,7],[16, ...builtin('__Symbol_prototype_toString')],[34,2],[15]],
|
@@ -2109,6 +2108,13 @@ export const BuiltinFuncs = function() {
|
|
2109
2108
|
locals: [124,127,127,127,124,124], localNames: ["key","key#type","#proto_target","#proto_target#type","#last_type","#typeswitch_tmp","#logicinner_tmp","out"],
|
2110
2109
|
globalInits: {descStore: (scope, {allocPage,glbl,loc}) => [...number(allocPage(scope, 'array: symbol.ts/descStore', 'f64') * pageSize, 124),...glbl(36, 'descStore', 124),...glbl(35, 'descStore', 124),[252,3],[33,loc('#makearray_pointer_tmp', 127)],[32,loc('#makearray_pointer_tmp', 127)],[65,0],[54,1,0],[32,loc('#makearray_pointer_tmp', 127)],[68,0,0,0,0,0,0,0,0],[252,3],[54,1,0],[32,loc('#makearray_pointer_tmp', 127)],[26]],forStore: (scope, {glbl,builtin}) => [[65,1],[68,0,0,0,0,0,0,0,0],[65,128,1],[16, ...builtin('Map')],[26],...glbl(36, 'forStore', 124)]},
|
2111
2110
|
};
|
2111
|
+
this.__Symbol_keyFor = {
|
2112
|
+
wasm: (scope, {glbl,builtin,internalThrow}) => [[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,28,64],[98],[4,64],...internalThrow(scope, 'TypeError', `Symbol.keyFor argument should be a Symbol`),[11],[32,0],[34,2],[65,7],[16, ...builtin('__Symbol_prototype_description$get')],[33,4],[33,3],...glbl(35, 'forStore', 124),[33,7],[65,20],[34,8],[33,9],[2,124],[32,9],[65,20],[70],[4,64,"TYPESWITCH|Map"],[32,7],[32,8],[32,3],[32,4],[16, ...builtin('__Map_prototype_get')],[33,5],[12,1],[11],...internalThrow(scope, 'TypeError', `'get' proto func tried to be called on a type without an impl`),[11,"TYPESWITCH_end"],[33,6],[32,2],[32,6],[97],[4,64],[32,3],[32,4],[15],[11],[68,0,0,0,0,0,0,0,0],[65,128,1],[15]],
|
2113
|
+
params: [124,127], typedParams: 1,
|
2114
|
+
returns: [124,127], typedReturns: 1,
|
2115
|
+
locals: [124,124,127,127,124,124,127,127], localNames: ["arg","arg#type","sym","desc","desc#type","#last_type","stored","#proto_target","#proto_target#type","#typeswitch_tmp"],
|
2116
|
+
globalInits: {descStore: (scope, {allocPage,glbl,loc}) => [...number(allocPage(scope, 'array: symbol.ts/descStore', 'f64') * pageSize, 124),...glbl(36, 'descStore', 124),...glbl(35, 'descStore', 124),[252,3],[33,loc('#makearray_pointer_tmp', 127)],[32,loc('#makearray_pointer_tmp', 127)],[65,0],[54,1,0],[32,loc('#makearray_pointer_tmp', 127)],[68,0,0,0,0,0,0,0,0],[252,3],[54,1,0],[32,loc('#makearray_pointer_tmp', 127)],[26]],forStore: (scope, {glbl,builtin}) => [[65,1],[68,0,0,0,0,0,0,0,0],[65,128,1],[16, ...builtin('Map')],[26],...glbl(36, 'forStore', 124)]},
|
2117
|
+
};
|
2112
2118
|
this.Uint8Array = {
|
2113
2119
|
wasm: (scope, {builtin,internalThrow}) => [[32,-1],[184],[65,2],[33,6],[33,7],[32,6],[33,8],[2,124],[32,8],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,7],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,8],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,7],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,7],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],...internalThrow(scope, 'TypeError', `Constructor Uint8Array requires 'new'`),[11],[65,12],[16, ...builtin('__Porffor_allocateBytes')],[183],[34,9],[33,10],[68,0,0,0,0,0,0,0,0],[33,11],[32,0],[32,1],[16, ...builtin('__Porffor_rawType')],[34,13],[68,0,0,0,0,0,0,53,64],[97],[32,13],[68,0,0,0,0,0,0,54,64],[97],[114],[4,64],[32,0],[33,12],[32,1],[33,8],[2,124],[32,8],[65,21],[70],[4,64,"TYPESWITCH|ArrayBuffer"],[32,0],[32,1],[16, ...builtin('__ArrayBuffer_prototype_detached$get')],[33,6],[12,1],[11],[68,0,0,0,0,0,0,0,0],[65,128,1],[33,6],[11,"TYPESWITCH_end"],[33,7],[32,6],[33,8],[2,127],[32,8],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,7],[252,3],[40,1,0],[12,1],[11],[32,8],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,7],[252,3],[40,1,0],[12,1],[11],[32,7],[252,3],[11,"TYPESWITCH_end"],[4,64],...internalThrow(scope, 'TypeError', `Constructed Uint8Array with a detached ArrayBuffer`),[11],[68,0,0,0,0,0,0,0,0],[33,14],[32,2],[32,3],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,96,64],[98],[4,64],[32,2],[16, ...builtin('__Math_trunc')],[33,14],[11],[32,14],[68,0,0,0,0,0,0,0,0],[99],[4,64],...internalThrow(scope, 'RangeError', `Invalid DataView byte offset (negative)`),[11],[32,10],[252,2],[32,14],[252,2],[54,0,8],[32,10],[252,2],[32,12],[32,14],[160],[252,2],[54,0,4],[32,4],[32,5],[16, ...builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,96,64],[97],[4,64],[32,12],[252,2],[40,0,0],[183],[34,15],[32,2],[161],[68,0,0,0,0,0,0,240,63],[163],[34,11],[16, ...builtin('__Number_isInteger')],[68,0,0,0,0,0,0,0,0],[97],[4,64],...internalThrow(scope, 'RangeError', `Byte length of Uint8Array should be divisible by BYTES_PER_ELEMENT`),[11],[5],[32,4],[16, ...builtin('__Math_trunc')],[33,11],[11],[5],[16, ...builtin('__Porffor_allocate')],[26],[33,12],[32,10],[252,2],[32,12],[252,2],[54,0,4],[32,13],[68,0,0,0,0,0,0,84,64],[97],[32,13],[68,0,0,0,0,0,192,80,64],[97],[114],[32,13],[68,0,0,0,0,0,96,104,64],[97],[114],[32,13],[68,0,0,0,0,0,0,51,64],[97],[114],[32,13],[68,0,0,0,0,0,0,86,64],[102],[32,13],[68,0,0,0,0,0,0,88,64],[101],[113],[114],[4,64],[68,0,0,0,0,0,0,0,0],[33,16],[32,0],[252,3],[33,17],[65,0],[33,19],[32,17],[40,1,0],[33,18],[32,1],[33,8],[2,64],[32,8],[65,19],[70],[4,64,"TYPESWITCH|Set"],[3,64],[32,17],[43,0,4],[32,17],[45,0,12],[33,21],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,17],[65,9],[106],[33,17],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[65,195,0],[33,21],[65,0],[65,1],[54,0,0],[3,64],[65,0],[32,17],[47,0,4],[59,0,4],[68,0,0,0,0,0,0,0,0],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,17],[65,2],[106],[33,17],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,208,0],[70],[4,64,"TYPESWITCH|Array"],[3,64],[32,17],[43,0,4],[32,17],[45,0,12],[33,21],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,17],[65,9],[106],[33,17],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,216,0],[70],[4,64,"TYPESWITCH|Uint8Array"],[65,1],[33,21],[3,64],[32,17],[40,0,4],[32,19],[106],[45,0,4],[184],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,217,0],[70],[4,64,"TYPESWITCH|Int8Array"],[65,1],[33,21],[3,64],[32,17],[40,0,4],[32,19],[106],[44,0,4],[183],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,218,0],[70],[4,64,"TYPESWITCH|Uint8ClampedArray"],[65,1],[33,21],[3,64],[32,17],[40,0,4],[32,19],[106],[45,0,4],[184],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,219,0],[70],[4,64,"TYPESWITCH|Uint16Array"],[65,1],[33,21],[3,64],[32,17],[40,0,4],[32,19],[65,2],[108],[106],[47,0,4],[184],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,220,0],[70],[4,64,"TYPESWITCH|Int16Array"],[65,1],[33,21],[3,64],[32,17],[40,0,4],[32,19],[65,2],[108],[106],[46,0,4],[183],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,221,0],[70],[4,64,"TYPESWITCH|Uint32Array"],[65,1],[33,21],[3,64],[32,17],[40,0,4],[32,19],[65,4],[108],[106],[40,0,4],[184],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,222,0],[70],[4,64,"TYPESWITCH|Int32Array"],[65,1],[33,21],[3,64],[32,17],[40,0,4],[32,19],[65,4],[108],[106],[40,0,4],[183],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,223,0],[70],[4,64,"TYPESWITCH|Float32Array"],[65,1],[33,21],[3,64],[32,17],[40,0,4],[32,19],[65,4],[108],[106],[42,0,4],[187],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,224,0],[70],[4,64,"TYPESWITCH|Float64Array"],[65,1],[33,21],[3,64],[32,17],[40,0,4],[32,19],[65,8],[108],[106],[43,0,4],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],[32,8],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[65,195,1],[33,21],[65,0],[65,1],[54,0,0],[3,64],[65,0],[32,17],[32,19],[106],[45,0,4],[58,0,4],[68,0,0,0,0,0,0,0,0],[33,20],[2,64],[32,9],[252,3],[40,0,4],[32,16],[32,16],[68,0,0,0,0,0,0,240,63],[160],[33,16],[252,3],[106],[32,20],[34,22],[252,3],[58,0,4],[65,1],[33,6],[32,19],[65,1],[106],[34,19],[32,18],[71],[13,1],[11],[11],[12,1],[11],...internalThrow(scope, 'TypeError', `Tried for..of on non-iterable type`),[11,"TYPESWITCH_end"],[32,16],[33,11],[5],[32,13],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,0],[16, ...builtin('__Math_trunc')],[33,11],[11],[11],[32,12],[252,2],[32,11],[68,0,0,0,0,0,0,240,63],[162],[252,2],[54,0,0],[11],[32,11],[68,0,0,0,0,0,0,0,0],[99],[4,64],...internalThrow(scope, 'RangeError', `Invalid TypedArray length (negative)`),[11],[32,11],[68,0,0,224,255,255,255,239,65],[100],[4,64],...internalThrow(scope, 'RangeError', `Invalid ArrayBuffer length (over 32 bit address space)`),[11],[32,10],[252,2],[32,11],[252,2],[54,0,0],[32,9],[65,216,0],[15]],
|
2114
2120
|
params: [124,127,124,127,124,127], typedParams: 1,
|
package/package.json
CHANGED