porffor 0.55.25 → 0.55.27
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/_internal_object.ts +6 -6
- package/compiler/builtins_precompiled.js +9 -7
- package/compiler/codegen.js +22 -0
- package/package.json +1 -1
- package/r.cjs +5 -5
- package/runner/index.js +1 -1
@@ -188,6 +188,7 @@ export const __Porffor_object_hash = (key: any): i32 => {
|
|
188
188
|
|
189
189
|
// bytestring or string, fnv-1a hash (custom variant)
|
190
190
|
// todo/opt: custom wasm simd variant?
|
191
|
+
// todo/opt: pgo for if no hash collisions?
|
191
192
|
|
192
193
|
let ptr: i32 = Porffor.wasm`local.get ${key}`;
|
193
194
|
const len: i32 = Porffor.wasm.i32.load(key, 0, 0);
|
@@ -371,15 +372,9 @@ export const __Porffor_object_lookup = (obj: any, target: any, targetHash: i32):
|
|
371
372
|
let ptr: i32 = Porffor.wasm`local.get ${obj}` + 8;
|
372
373
|
const endPtr: i32 = ptr + Porffor.wasm.i32.load16_u(obj, 0, 0) * 18;
|
373
374
|
|
374
|
-
let out: boolean = false;
|
375
375
|
if (Porffor.wasm`local.get ${target+1}` == Porffor.TYPES.symbol) {
|
376
376
|
for (; ptr < endPtr; ptr += 18) {
|
377
377
|
const key: i32 = Porffor.wasm.i32.load(ptr, 0, 4);
|
378
|
-
if (key == 0) {
|
379
|
-
if (out) break; // ran out of keys
|
380
|
-
out = true;
|
381
|
-
}
|
382
|
-
|
383
378
|
if ((key >>> 30) == 3) { // MSB 1 and 2 set, symbol (unset MSB x2)
|
384
379
|
// todo: remove casts once weird bug which breaks unrelated things is fixed (https://github.com/CanadaHonk/porffor/commit/5747f0c1f3a4af95283ebef175cdacb21e332a52)
|
385
380
|
if ((key & 0x3FFFFFFF) as symbol == target as symbol) return ptr;
|
@@ -389,6 +384,11 @@ export const __Porffor_object_lookup = (obj: any, target: any, targetHash: i32):
|
|
389
384
|
for (; ptr < endPtr; ptr += 18) {
|
390
385
|
if (Porffor.wasm.i32.load(ptr, 0, 0) == targetHash) {
|
391
386
|
const key: i32 = Porffor.wasm.i32.load(ptr, 0, 4);
|
387
|
+
|
388
|
+
// fast path: check if same pointer first
|
389
|
+
if (key == Porffor.wasm`local.get ${target}`) return ptr;
|
390
|
+
|
391
|
+
// slow path: strcmp
|
392
392
|
Porffor.wasm`
|
393
393
|
local.get ${key}
|
394
394
|
i32.const 2147483647
|
@@ -7,7 +7,7 @@ wasm:(_,{makeString,glbl,builtin})=>[[32,1],[184],[34,2],[68,7],[97],[4,64],[32,
|
|
7
7
|
params:[124,127],typedParams:1,returns:[124,127],
|
8
8
|
locals:[124,124,124,124,124,124,124,124,124,124,124,127,124,124,127,124,124,124,127,124,124,124,124,124],localNames:["obj","obj#type","t","idx","underlying","proto","key1","key2","key3","key4","len","key5","i","#last_type","#member_obj_0","#member_prop_0","#loadArray_offset","key6","#member_obj_1","#member_prop_1","#member_allocd","key7","#member_obj_2","#member_prop_2","#member_obj_3","#member_prop_3"],
|
9
9
|
usedTypes:[7,80,195,67],
|
10
|
-
globalInits:{underlyingKeys:(_,{allocPage,glbl})=>[number(allocPage(_,'__internal_object.ts/underlyingKeys'),124),...glbl(36,'underlyingKeys',124),[65,16],[26]],underlyingVals:(_,{allocPage,glbl})=>[number(allocPage(_,'__internal_object.ts/underlyingVals'),124),...glbl(36,'underlyingVals',124),[65,128,128,
|
10
|
+
globalInits:{underlyingKeys:(_,{allocPage,glbl})=>[number(allocPage(_,'__internal_object.ts/underlyingKeys'),124),...glbl(36,'underlyingKeys',124),[65,16],[26]],underlyingVals:(_,{allocPage,glbl})=>[number(allocPage(_,'__internal_object.ts/underlyingVals'),124),...glbl(36,'underlyingVals',124),[65,128,128,1],[26]]},
|
11
11
|
}
|
12
12
|
this.__Porffor_strcmp = {
|
13
13
|
wasm:()=>[[32,0],[32,2],[70],[4,64],[65,1],[15],[26],[11],[32,0],[40,0,0],[33,4],[32,2],[40,0,0],[33,5],[32,4],[32,5],[71],[4,64],[65,0],[15],[26],[11],[32,1],[65,195,1],[70],[4,64],[32,3],[65,195,1],[70],[4,64],[32,0],[65,28],[107],[33,6],[32,2],[65,28],[107],[33,7],[32,0],[65,4],[107],[33,8],[32,2],[65,4],[107],[33,9],[32,4],[65,32],[78],[4,64],[3,64],[32,6],[32,4],[106],[253,0,0,0],[32,7],[32,4],[106],[253,0,0,0],[253,81],[32,6],[32,4],[106],[253,0,0,16],[32,7],[32,4],[106],[253,0,0,16],[253,81],[253,80],[253,83],[4,64],[65,0],[15],[11],[32,4],[65,32],[107],[34,4],[65,32],[78],[13,0],[11],[11],[32,4],[65,8],[78],[4,64],[3,64],[32,8],[32,4],[106],[41,0,0],[32,9],[32,4],[106],[41,0,0],[82],[4,64],[65,0],[15],[11],[32,4],[65,8],[107],[34,4],[65,8],[78],[13,0],[11],[11],[32,4],[65,2],[78],[4,64],[3,64],[32,0],[32,4],[106],[47,0,2],[32,2],[32,4],[106],[47,0,2],[71],[4,64],[65,0],[15],[11],[32,4],[65,2],[107],[34,4],[65,2],[78],[13,0],[11],[11],[32,4],[65,1],[70],[4,64],[32,0],[45,0,4],[32,2],[45,0,4],[71],[4,64],[65,0],[15],[26],[11],[11],[65,1],[15],[26],[5],[65,0],[33,10],[3,64],[32,10],[32,4],[72],[4,64],[32,0],[32,10],[106],[45,0,4],[32,2],[32,10],[65,2],[108],[106],[47,0,4],[71],[4,64],[65,0],[15],[26],[11],[32,10],[65,1],[106],[33,10],[12,1],[11],[11],[65,1],[15],[26],[11],[5],[32,3],[65,195,1],[70],[4,64],[65,0],[33,10],[3,64],[32,10],[32,4],[72],[4,64],[32,0],[32,10],[65,2],[108],[106],[47,0,4],[32,2],[32,10],[106],[45,0,4],[71],[4,64],[65,0],[15],[26],[11],[32,10],[65,1],[106],[33,10],[12,1],[11],[11],[65,1],[15],[26],[5],[32,4],[65,2],[108],[33,4],[32,5],[65,2],[108],[33,5],[32,0],[65,28],[107],[33,6],[32,2],[65,28],[107],[33,7],[32,0],[65,4],[107],[33,8],[32,2],[65,4],[107],[33,9],[32,4],[65,32],[78],[4,64],[3,64],[32,6],[32,4],[106],[253,0,0,0],[32,7],[32,4],[106],[253,0,0,0],[253,81],[32,6],[32,4],[106],[253,0,0,16],[32,7],[32,4],[106],[253,0,0,16],[253,81],[253,80],[253,83],[4,64],[65,0],[15],[11],[32,4],[65,32],[107],[34,4],[65,32],[78],[13,0],[11],[11],[32,4],[65,8],[78],[4,64],[3,64],[32,8],[32,4],[106],[41,0,0],[32,9],[32,4],[106],[41,0,0],[82],[4,64],[65,0],[15],[11],[32,4],[65,8],[107],[34,4],[65,8],[78],[13,0],[11],[11],[32,4],[65,2],[78],[4,64],[3,64],[32,0],[32,4],[106],[47,0,2],[32,2],[32,4],[106],[47,0,2],[71],[4,64],[65,0],[15],[11],[32,4],[65,2],[107],[34,4],[65,2],[78],[13,0],[11],[11],[65,1],[15],[26],[11],[11],[65,0],[15]],
|
@@ -86,9 +86,9 @@ params:[127,127],typedParams:1,returns:[127],returnType:1,
|
|
86
86
|
locals:[127,127,127,127,126,126],localNames:["key","key#type","ptr","len","hash","endPtr","x","shift"],
|
87
87
|
}
|
88
88
|
this.__Porffor_object_lookup = {
|
89
|
-
wasm:(_,{builtin})=>[[32,0],[69],[4,64],[65,127],[15],[26],[11],[32,1],[65,7],[71],[4,64],[32,0],[183],[32,1],[16,builtin('__Porffor_object_underlying')],[33,6],[252,2],[33,0],[32,6],[34,1],[65,7],[71],[4,64],[65,127],[15],[26],[11],[11],[32,0],[65,8],[106],[34,7],[32,0],[47,0,0],[65,18],[108],[106],[33,8],[
|
89
|
+
wasm:(_,{builtin})=>[[32,0],[69],[4,64],[65,127],[15],[26],[11],[32,1],[65,7],[71],[4,64],[32,0],[183],[32,1],[16,builtin('__Porffor_object_underlying')],[33,6],[252,2],[33,0],[32,6],[34,1],[65,7],[71],[4,64],[65,127],[15],[26],[11],[11],[32,0],[65,8],[106],[34,7],[32,0],[47,0,0],[65,18],[108],[106],[33,8],[32,3],[65,5],[70],[4,64],[3,64],[32,7],[32,8],[72],[4,64],[32,7],[40,0,4],[34,9],[65,30],[118],[65,3],[70],[4,64],[32,9],[65,255,255,255,255,3],[113],[32,2],[70],[4,64],[32,7],[15],[26],[11],[11],[32,7],[65,18],[106],[33,7],[12,1],[11],[11],[5],[3,64],[32,7],[32,8],[72],[4,64],[32,7],[40,0,0],[32,4],[70],[4,64],[32,7],[40,0,4],[34,9],[32,2],[70],[4,64],[32,7],[15],[26],[11],[32,9],[65,255,255,255,255,7],[113],[65,195,0],[65,195,1],[32,9],[65,30],[118],[27],[32,2],[32,3],[16,builtin('__Porffor_strcmp')],[4,64],[32,7],[15],[11],[11],[32,7],[65,18],[106],[33,7],[12,1],[11],[11],[11],[65,127],[15]],
|
90
90
|
params:[127,127,127,127,127,127],typedParams:1,returns:[127],returnType:1,
|
91
|
-
locals:[127,127,127,127
|
91
|
+
locals:[127,127,127,127],localNames:["obj","obj#type","target","target#type","targetHash","targetHash#type","#last_type","ptr","endPtr","key"],
|
92
92
|
usedTypes:[5],
|
93
93
|
}
|
94
94
|
this.__Porffor_object_readValue = {
|
@@ -745,7 +745,7 @@ params:[124,127],typedParams:1,returns:[124],returnType:1,
|
|
745
745
|
locals:[124,124,124,124,124],localNames:["x","x#type","negative","len","out","i","d"],
|
746
746
|
}
|
747
747
|
this.__Porffor_bigint_fromString = {
|
748
|
-
wasm:(_,{t,makeString,builtin,internalThrow})=>[[32,0],[252,3],[40,1,0],[184],[33,2],[68,0],[33,3],[68,0],[33,4],[68,0],[33,6],[32,0],[33,5],[32,1],[33,8],[2,124],...t([67],()=>[[32,8],[65,195,0],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,9],[65,1],[54,0,0],[32,9],[32,6],[252,3],[65,2],[108],[32,5],[252,3],[106],[47,0,4],[59,0,4],[32,9],[184],[65,195,0],[33,7],[12,1],[11]]),...t([80],()=>[[32,8],[65,208,0],[70],[4,64],[32,6],[252,3],[65,9],[108],[32,5],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,7],[12,1],[11]]),...t([88],()=>[[32,8],[65,216,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([89],()=>[[32,8],[65,217,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([90],()=>[[32,8],[65,218,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([91],()=>[[32,8],[65,219,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([92],()=>[[32,8],[65,220,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([93],()=>[[32,8],[65,221,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([94],()=>[[32,8],[65,222,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([95],()=>[[32,8],[65,223,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11]]),...t([96],()=>[[32,8],[65,224,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11]]),...t([128],()=>[[32,8],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),...t([195],()=>[[32,8],[65,195,1],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,9],[65,1],[54,0,0],[32,9],[32,6],[252,3],[32,5],[252,3],[106],[45,0,4],[58,0,4],[32,9],[184],[65,195,1],[33,7],[12,1],[11]]),[32,5],[252,2],[32,1],[32,6],[65,1],[16,builtin('__ecma262_ToPropertyKey')],[33,11],[252,2],[32,11],[16,builtin('__Porffor_object_get')],[33,7],[11],[32,7],...makeString(_,"-",1),[65,195,1],[16,builtin('__Porffor_compareStrings')],[252,3],[4,64],[68,1],[33,3],[68,1],[33,4],[5],[68,0],[33,13],[32,0],[33,12],[32,1],[33,8],[2,124],...t([67],()=>[[32,8],[65,195,0],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,9],[65,1],[54,0,0],[32,9],[32,13],[252,3],[65,2],[108],[32,12],[252,3],[106],[47,0,4],[59,0,4],[32,9],[184],[65,195,0],[33,7],[12,1],[11]]),...t([80],()=>[[32,8],[65,208,0],[70],[4,64],[32,13],[252,3],[65,9],[108],[32,12],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,7],[12,1],[11]]),...t([88],()=>[[32,8],[65,216,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([89],()=>[[32,8],[65,217,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([90],()=>[[32,8],[65,218,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([91],()=>[[32,8],[65,219,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([92],()=>[[32,8],[65,220,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([93],()=>[[32,8],[65,221,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([94],()=>[[32,8],[65,222,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([95],()=>[[32,8],[65,223,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11]]),...t([96],()=>[[32,8],[65,224,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11]]),...t([128],()=>[[32,8],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),...t([195],()=>[[32,8],[65,195,1],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,9],[65,1],[54,0,0],[32,9],[32,13],[252,3],[32,12],[252,3],[106],[45,0,4],[58,0,4],[32,9],[184],[65,195,1],[33,7],[12,1],[11]]),[32,12],[252,2],[32,1],[32,13],[65,1],[16,builtin('__ecma262_ToPropertyKey')],[33,11],[252,2],[32,11],[16,builtin('__Porffor_object_get')],[33,7],[11],[32,7],...makeString(_,"+",1),[65,195,1],[16,builtin('__Porffor_compareStrings')],[252,3],[4,64],[68,1],[33,4],[11],[11],[68,4294967296],[33,14],[16,builtin('__Porffor_allocate')],[183],[34,15],[252,3],[32,2],[32,4],[161],[252,3],[54,1,0],[68,0],[33,16],[68,0],[33,17],[3,64],[32,16],[32,2],[99],[4,64],[32,0],[252,3],[40,1,0],[33,19],[32,1],[33,8],[2,124],...t([39],()=>[[32,8],[65,39],[70],[4,64],[65,1],[33,7],[32,4],[32,16],[160],[252,2],[65,2],[108],[32,0],[252,3],[106],[47,0,4],[184],[12,1],[11]]),...t([67],()=>[[32,8],[65,195,0],[70],[4,64],[65,1],[33,7],[32,4],[32,16],[160],[252,2],[65,2],[108],[32,0],[252,3],[106],[47,0,4],[184],[12,1],[11]]),...t([195],()=>[[32,8],[65,195,1],[70],[4,64],[65,1],[33,7],[32,4],[32,16],[160],[252,2],[32,0],[252,3],[106],[45,0,4],[184],[12,1],[11]]),...internalThrow(_,'TypeError',`'charCodeAt' proto func tried to be called on a type without an impl`),[68,0],[11],[34,18],[68,48],[161],[34,22],[68,0],[99],[32,22],[68,9],[100],[114],[4,64],...internalThrow(_,'SyntaxError',`Invalid character in BigInt string`),[26],[11],[32,15],[33,24],[32,16],[32,16],[68,1],[160],[33,16],[33,25],[32,24],[252,3],[32,25],[252,3],[65,9],[108],[106],[34,23],[32,22],[57,0,4],[32,23],[65,1],[58,0,12],[32,17],[68,10],[162],[32,22],[160],[33,17],[12,1],[11],[11],[32,17],[68,2251799813685248],[99],[4,64],[32,17],[15],[26],[11],[16,builtin('__Porffor_allocate')],[183],[33,26],[3,64],[32,15],[252,3],[40,1,0],[184],[68,0],[100],[4,64],[68,0],[33,27],[68,0],[33,28],[3,64],[32,28],[32,15],[252,3],[40,1,0],[184],[99],[4,64],[32,27],[68,10],[162],[32,28],[33,31],[32,15],[33,30],[32,31],[252,3],[65,9],[108],[32,30],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,7],[160],[34,29],[32,14],[163],[16,builtin('__Math_floor')],[33,32],[32,29],[32,14],[16,builtin('f64_%')],[33,27],[32,15],[33,33],[32,28],[33,34],[32,33],[252,3],[32,34],[252,3],[65,9],[108],[106],[34,23],[32,32],[57,0,4],[32,23],[65,1],[58,0,12],[32,28],[68,1],[160],[33,28],[12,1],[11],[11],[3,64],[32,15],[252,3],[40,1,0],[184],[68,0],[100],[34,37],[4,127],[68,0],[33,36],[32,15],[33,35],[32,36],[252,3],[65,9],[108],[32,35],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,7],[68,0],[97],[32,7],[65,128,1],[114],[65,1],[65,128,1],[114],[70],[113],[65,2],[33,7],[5],[32,37],[65,2],[33,7],[11],[4,64],[32,15],[252,3],[34,20],[40,1,0],[33,19],[2,64],[32,19],[69],[4,64],[68,0],[65,128,1],[33,7],[12,1],[11],[32,20],[32,19],[65,1],[107],[34,19],[54,1,0],[32,20],[43,0,4],[32,20],[45,0,12],[33,7],[65,4],[32,20],[106],[65,13],[32,20],[106],[32,19],[65,9],[108],[252,10,0,0],[26],[11],[12,1],[11],[11],[32,27],[68,0],[98],[34,37],[69],[4,127],[32,15],[252,3],[40,1,0],[184],[68,0],[100],[65,2],[33,7],[5],[32,37],[65,2],[33,7],[11],[4,64],[32,26],[33,38],[65,208,0],[33,39],[32,38],[32,39],[65,128,128,
|
748
|
+
wasm:(_,{t,makeString,builtin,internalThrow})=>[[32,0],[252,3],[40,1,0],[184],[33,2],[68,0],[33,3],[68,0],[33,4],[68,0],[33,6],[32,0],[33,5],[32,1],[33,8],[2,124],...t([67],()=>[[32,8],[65,195,0],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,9],[65,1],[54,0,0],[32,9],[32,6],[252,3],[65,2],[108],[32,5],[252,3],[106],[47,0,4],[59,0,4],[32,9],[184],[65,195,0],[33,7],[12,1],[11]]),...t([80],()=>[[32,8],[65,208,0],[70],[4,64],[32,6],[252,3],[65,9],[108],[32,5],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,7],[12,1],[11]]),...t([88],()=>[[32,8],[65,216,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([89],()=>[[32,8],[65,217,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([90],()=>[[32,8],[65,218,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([91],()=>[[32,8],[65,219,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([92],()=>[[32,8],[65,220,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([93],()=>[[32,8],[65,221,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([94],()=>[[32,8],[65,222,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([95],()=>[[32,8],[65,223,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11]]),...t([96],()=>[[32,8],[65,224,0],[70],[4,64],[32,5],[252,3],[40,0,4],[32,6],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11]]),...t([128],()=>[[32,8],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),...t([195],()=>[[32,8],[65,195,1],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,9],[65,1],[54,0,0],[32,9],[32,6],[252,3],[32,5],[252,3],[106],[45,0,4],[58,0,4],[32,9],[184],[65,195,1],[33,7],[12,1],[11]]),[32,5],[252,2],[32,1],[32,6],[65,1],[16,builtin('__ecma262_ToPropertyKey')],[33,11],[252,2],[32,11],[16,builtin('__Porffor_object_get')],[33,7],[11],[32,7],...makeString(_,"-",1),[65,195,1],[16,builtin('__Porffor_compareStrings')],[252,3],[4,64],[68,1],[33,3],[68,1],[33,4],[5],[68,0],[33,13],[32,0],[33,12],[32,1],[33,8],[2,124],...t([67],()=>[[32,8],[65,195,0],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,9],[65,1],[54,0,0],[32,9],[32,13],[252,3],[65,2],[108],[32,12],[252,3],[106],[47,0,4],[59,0,4],[32,9],[184],[65,195,0],[33,7],[12,1],[11]]),...t([80],()=>[[32,8],[65,208,0],[70],[4,64],[32,13],[252,3],[65,9],[108],[32,12],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,7],[12,1],[11]]),...t([88],()=>[[32,8],[65,216,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([89],()=>[[32,8],[65,217,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[106],[44,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([90],()=>[[32,8],[65,218,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[106],[45,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([91],()=>[[32,8],[65,219,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,2],[108],[106],[47,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([92],()=>[[32,8],[65,220,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,2],[108],[106],[46,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([93],()=>[[32,8],[65,221,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,4],[108],[106],[40,0,4],[184],[65,1],[33,7],[12,1],[11]]),...t([94],()=>[[32,8],[65,222,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,4],[108],[106],[40,0,4],[183],[65,1],[33,7],[12,1],[11]]),...t([95],()=>[[32,8],[65,223,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,4],[108],[106],[42,0,4],[187],[65,1],[33,7],[12,1],[11]]),...t([96],()=>[[32,8],[65,224,0],[70],[4,64],[32,12],[252,3],[40,0,4],[32,13],[252,3],[65,8],[108],[106],[43,0,4],[65,1],[33,7],[12,1],[11]]),...t([128],()=>[[32,8],[65,128,1],[70],[4,64],...internalThrow(_,'TypeError',`Cannot read property of undefined`),[68,0],[12,1],[11]]),...t([195],()=>[[32,8],[65,195,1],[70],[4,64],[65,8],[16,builtin('__Porffor_allocateBytes')],[34,9],[65,1],[54,0,0],[32,9],[32,13],[252,3],[32,12],[252,3],[106],[45,0,4],[58,0,4],[32,9],[184],[65,195,1],[33,7],[12,1],[11]]),[32,12],[252,2],[32,1],[32,13],[65,1],[16,builtin('__ecma262_ToPropertyKey')],[33,11],[252,2],[32,11],[16,builtin('__Porffor_object_get')],[33,7],[11],[32,7],...makeString(_,"+",1),[65,195,1],[16,builtin('__Porffor_compareStrings')],[252,3],[4,64],[68,1],[33,4],[11],[11],[68,4294967296],[33,14],[16,builtin('__Porffor_allocate')],[183],[34,15],[252,3],[32,2],[32,4],[161],[252,3],[54,1,0],[68,0],[33,16],[68,0],[33,17],[3,64],[32,16],[32,2],[99],[4,64],[32,0],[252,3],[40,1,0],[33,19],[32,1],[33,8],[2,124],...t([39],()=>[[32,8],[65,39],[70],[4,64],[65,1],[33,7],[32,4],[32,16],[160],[252,2],[65,2],[108],[32,0],[252,3],[106],[47,0,4],[184],[12,1],[11]]),...t([67],()=>[[32,8],[65,195,0],[70],[4,64],[65,1],[33,7],[32,4],[32,16],[160],[252,2],[65,2],[108],[32,0],[252,3],[106],[47,0,4],[184],[12,1],[11]]),...t([195],()=>[[32,8],[65,195,1],[70],[4,64],[65,1],[33,7],[32,4],[32,16],[160],[252,2],[32,0],[252,3],[106],[45,0,4],[184],[12,1],[11]]),...internalThrow(_,'TypeError',`'charCodeAt' proto func tried to be called on a type without an impl`),[68,0],[11],[34,18],[68,48],[161],[34,22],[68,0],[99],[32,22],[68,9],[100],[114],[4,64],...internalThrow(_,'SyntaxError',`Invalid character in BigInt string`),[26],[11],[32,15],[33,24],[32,16],[32,16],[68,1],[160],[33,16],[33,25],[32,24],[252,3],[32,25],[252,3],[65,9],[108],[106],[34,23],[32,22],[57,0,4],[32,23],[65,1],[58,0,12],[32,17],[68,10],[162],[32,22],[160],[33,17],[12,1],[11],[11],[32,17],[68,2251799813685248],[99],[4,64],[32,17],[15],[26],[11],[16,builtin('__Porffor_allocate')],[183],[33,26],[3,64],[32,15],[252,3],[40,1,0],[184],[68,0],[100],[4,64],[68,0],[33,27],[68,0],[33,28],[3,64],[32,28],[32,15],[252,3],[40,1,0],[184],[99],[4,64],[32,27],[68,10],[162],[32,28],[33,31],[32,15],[33,30],[32,31],[252,3],[65,9],[108],[32,30],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,7],[160],[34,29],[32,14],[163],[16,builtin('__Math_floor')],[33,32],[32,29],[32,14],[16,builtin('f64_%')],[33,27],[32,15],[33,33],[32,28],[33,34],[32,33],[252,3],[32,34],[252,3],[65,9],[108],[106],[34,23],[32,32],[57,0,4],[32,23],[65,1],[58,0,12],[32,28],[68,1],[160],[33,28],[12,1],[11],[11],[3,64],[32,15],[252,3],[40,1,0],[184],[68,0],[100],[34,37],[4,127],[68,0],[33,36],[32,15],[33,35],[32,36],[252,3],[65,9],[108],[32,35],[252,3],[106],[34,10],[43,0,4],[32,10],[45,0,12],[33,7],[68,0],[97],[32,7],[65,128,1],[114],[65,1],[65,128,1],[114],[70],[113],[65,2],[33,7],[5],[32,37],[65,2],[33,7],[11],[4,64],[32,15],[252,3],[34,20],[40,1,0],[33,19],[2,64],[32,19],[69],[4,64],[68,0],[65,128,1],[33,7],[12,1],[11],[32,20],[32,19],[65,1],[107],[34,19],[54,1,0],[32,20],[43,0,4],[32,20],[45,0,12],[33,7],[65,4],[32,20],[106],[65,13],[32,20],[106],[32,19],[65,9],[108],[252,10,0,0],[26],[11],[12,1],[11],[11],[32,27],[68,0],[98],[34,37],[69],[4,127],[32,15],[252,3],[40,1,0],[184],[68,0],[100],[65,2],[33,7],[5],[32,37],[65,2],[33,7],[11],[4,64],[32,26],[33,38],[65,208,0],[33,39],[32,38],[32,39],[65,128,128,1],[32,27],[57,0,4],[65,128,128,1],[65,1],[58,0,12],[65,128,128,1],[65,1],[54,1,0],[68,16384],[65,208,0],[16,builtin('__Array_prototype_unshift')],[33,7],[26],[11],[12,1],[11],[11],[32,3],[65,2],[32,26],[65,208,0],[16,builtin('__Porffor_bigint_fromDigits')],[15]],
|
749
749
|
params:[124,127],typedParams:1,returns:[124],returnType:4,
|
750
750
|
locals:[124,124,124,124,124,127,127,127,127,127,124,124,124,124,124,124,124,127,127,127,124,127,124,124,124,124,124,124,124,124,124,124,124,124,124,127,124,127],localNames:["n","n#type","len","negative","offset","#member_obj_86","#member_prop_86","#last_type","#typeswitch_tmp1","#member_allocd","#loadArray_offset","#swap","#member_obj_87","#member_prop_87","BASE","digits","i","acc","char","__proto_length_cache","__proto_pointer_cache","__charCodeAt_tmp","digit","#member_setter_ptr_tmp","#member_obj_88","#member_prop_88","result","carry","j","value","#member_obj_89","#member_prop_89","quotient","#member_obj_90","#member_prop_90","#member_obj_91","#member_prop_91","logictmpi","#proto_target","#proto_target#type"],
|
751
751
|
usedTypes:[67,195,80],
|
@@ -757,7 +757,7 @@ params:[124,127,124,127],typedParams:1,returns:[124,127],
|
|
757
757
|
locals:[127],localNames:["x","x#type","radix","radix#type","#last_type"],
|
758
758
|
}
|
759
759
|
this.__Porffor_bigint_add = {
|
760
|
-
wasm:(_,{builtin})=>[[32,0],[16,builtin('__Math_abs')],[68,2251799813685248],[99],[4,64],[32,2],[16,builtin('__Math_abs')],[68,2251799813685248],[99],[4,64],[32,4],[252,3],[4,64],[32,2],[154],[33,2],[11],[32,0],[32,2],[160],[16,builtin('__Math_trunc')],[65,1],[16,builtin('__Porffor_bigint_fromNumber')],[15],[26],[11],[32,0],[65,1],[16,builtin('__Porffor_bigint_inlineToDigitForm')],[33,0],[5],[32,2],[16,builtin('__Math_abs')],[68,2251799813685248],[99],[4,64],[32,2],[65,1],[16,builtin('__Porffor_bigint_inlineToDigitForm')],[33,2],[11],[11],[32,0],[68,2251799813685248],[161],[33,0],[32,2],[68,2251799813685248],[161],[33,2],[32,0],[252,2],[45,0,0],[183],[68,0],[98],[184],[33,6],[32,0],[252,2],[47,0,2],[183],[33,7],[32,2],[252,2],[45,0,0],[183],[68,0],[98],[184],[33,8],[32,4],[252,3],[4,64],[32,8],[68,0],[97],[184],[33,8],[11],[32,2],[252,2],[47,0,2],[183],[33,9],[68,"-Infinity"],[32,7],[165],[32,9],[165],[33,10],[16,builtin('__Porffor_allocate')],[183],[33,11],[68,0],[33,12],[68,0],[33,13],[32,6],[32,8],[97],[4,64],[32,6],[33,12],[68,0],[33,14],[3,64],[32,14],[32,10],[99],[4,64],[68,0],[33,15],[32,7],[32,14],[161],[34,16],[68,0],[100],[4,64],[32,0],[32,16],[68,4],[162],[160],[252,2],[40,0,0],[183],[33,15],[11],[68,0],[33,17],[32,9],[32,14],[161],[34,18],[68,0],[100],[4,64],[32,2],[32,18],[68,4],[162],[160],[252,2],[40,0,0],[183],[33,17],[11],[32,15],[32,17],[160],[32,13],[160],[34,19],[68,4294967296],[102],[4,64],[32,19],[68,4294967296],[161],[33,19],[68,1],[33,13],[5],[32,19],[68,0],[99],[4,64],[32,19],[68,4294967296],[160],[33,19],[68,1],[33,13],[5],[68,0],[33,13],[11],[11],[32,11],[33,20],[65,208,0],[33,21],[32,20],[32,21],[65,128,128,
|
760
|
+
wasm:(_,{builtin})=>[[32,0],[16,builtin('__Math_abs')],[68,2251799813685248],[99],[4,64],[32,2],[16,builtin('__Math_abs')],[68,2251799813685248],[99],[4,64],[32,4],[252,3],[4,64],[32,2],[154],[33,2],[11],[32,0],[32,2],[160],[16,builtin('__Math_trunc')],[65,1],[16,builtin('__Porffor_bigint_fromNumber')],[15],[26],[11],[32,0],[65,1],[16,builtin('__Porffor_bigint_inlineToDigitForm')],[33,0],[5],[32,2],[16,builtin('__Math_abs')],[68,2251799813685248],[99],[4,64],[32,2],[65,1],[16,builtin('__Porffor_bigint_inlineToDigitForm')],[33,2],[11],[11],[32,0],[68,2251799813685248],[161],[33,0],[32,2],[68,2251799813685248],[161],[33,2],[32,0],[252,2],[45,0,0],[183],[68,0],[98],[184],[33,6],[32,0],[252,2],[47,0,2],[183],[33,7],[32,2],[252,2],[45,0,0],[183],[68,0],[98],[184],[33,8],[32,4],[252,3],[4,64],[32,8],[68,0],[97],[184],[33,8],[11],[32,2],[252,2],[47,0,2],[183],[33,9],[68,"-Infinity"],[32,7],[165],[32,9],[165],[33,10],[16,builtin('__Porffor_allocate')],[183],[33,11],[68,0],[33,12],[68,0],[33,13],[32,6],[32,8],[97],[4,64],[32,6],[33,12],[68,0],[33,14],[3,64],[32,14],[32,10],[99],[4,64],[68,0],[33,15],[32,7],[32,14],[161],[34,16],[68,0],[100],[4,64],[32,0],[32,16],[68,4],[162],[160],[252,2],[40,0,0],[183],[33,15],[11],[68,0],[33,17],[32,9],[32,14],[161],[34,18],[68,0],[100],[4,64],[32,2],[32,18],[68,4],[162],[160],[252,2],[40,0,0],[183],[33,17],[11],[32,15],[32,17],[160],[32,13],[160],[34,19],[68,4294967296],[102],[4,64],[32,19],[68,4294967296],[161],[33,19],[68,1],[33,13],[5],[32,19],[68,0],[99],[4,64],[32,19],[68,4294967296],[160],[33,19],[68,1],[33,13],[5],[68,0],[33,13],[11],[11],[32,11],[33,20],[65,208,0],[33,21],[32,20],[32,21],[65,128,128,2],[32,19],[57,0,4],[65,128,128,2],[65,1],[58,0,12],[65,128,128,2],[65,1],[54,1,0],[68,32768],[65,208,0],[16,builtin('__Array_prototype_unshift')],[33,22],[26],[32,14],[68,1],[160],[33,14],[12,1],[11],[11],[5],[68,0],[33,23],[68,0],[33,14],[3,64],[32,14],[32,10],[99],[4,64],[68,0],[33,15],[32,7],[32,14],[161],[34,16],[68,0],[100],[4,64],[32,0],[32,16],[68,4],[162],[160],[252,2],[40,0,0],[183],[33,15],[11],[68,0],[33,17],[32,9],[32,14],[161],[34,18],[68,0],[100],[4,64],[32,2],[32,18],[68,4],[162],[160],[252,2],[40,0,0],[183],[33,17],[11],[32,13],[33,19],[32,6],[252,3],[4,64],[32,19],[32,15],[161],[33,19],[5],[32,19],[32,15],[160],[33,19],[11],[32,8],[252,3],[4,64],[32,19],[32,17],[161],[33,19],[5],[32,19],[32,17],[160],[33,19],[11],[32,15],[32,17],[98],[4,64],[32,15],[32,17],[100],[4,124],[68,1],[65,1],[33,22],[5],[68,-1],[65,1],[33,22],[11],[33,23],[11],[32,19],[68,4294967296],[102],[4,64],[32,19],[68,4294967296],[161],[33,19],[68,1],[33,13],[5],[32,19],[68,0],[99],[4,64],[32,19],[68,4294967296],[160],[33,19],[68,-1],[33,13],[5],[68,0],[33,13],[11],[11],[32,11],[33,20],[65,208,0],[33,21],[32,20],[32,21],[65,128,128,3],[32,19],[57,0,4],[65,128,128,3],[65,1],[58,0,12],[65,128,128,3],[65,1],[54,1,0],[68,49152],[65,208,0],[16,builtin('__Array_prototype_unshift')],[33,22],[26],[32,14],[68,1],[160],[33,14],[12,1],[11],[11],[32,23],[68,1],[97],[4,64],[32,6],[33,12],[5],[32,23],[68,-1],[97],[4,64],[32,8],[33,12],[11],[11],[11],[32,13],[68,0],[98],[4,64],[32,11],[33,20],[65,208,0],[33,21],[32,20],[32,21],[65,128,128,4],[32,13],[16,builtin('__Math_abs')],[57,0,4],[65,128,128,4],[65,1],[58,0,12],[65,128,128,4],[65,1],[54,1,0],[68,65536],[65,208,0],[16,builtin('__Array_prototype_unshift')],[33,22],[26],[32,13],[68,0],[99],[4,64],[32,12],[68,0],[97],[184],[33,12],[11],[11],[32,12],[65,2],[32,11],[65,208,0],[16,builtin('__Porffor_bigint_fromDigits')],[15]],
|
761
761
|
params:[124,127,124,127,124,127],typedParams:1,returns:[124],returnType:4,
|
762
762
|
locals:[124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,127,127,124],localNames:["a","a#type","b","b#type","sub","sub#type","aNegative","aLen","bNegative","bLen","maxLen","digits","negative","carry","i","aDigit","aOffset","bDigit","bOffset","sum","#proto_target","#proto_target#type","#last_type","aLarger"],
|
763
763
|
usedTypes:[80],
|
@@ -2449,14 +2449,16 @@ globalInits:{jobQueue:(_,{allocPage,glbl})=>[number(allocPage(_,'promise.ts/jobQ
|
|
2449
2449
|
table:1,usesTag:1,
|
2450
2450
|
}
|
2451
2451
|
this.__Porffor_promise_resolveActive = {
|
2452
|
-
wasm:()=>[[15]],
|
2452
|
+
wasm:(_,{glbl,builtin})=>[[32,0],[32,1],...glbl(35,'activePromise',124),...glbl(35,'activePromise#type',127),[16,builtin('__Porffor_promise_resolve')],[68,0],[15]],
|
2453
2453
|
params:[124,127],typedParams:1,returns:[],returnType:128,
|
2454
2454
|
locals:[],localNames:["value","value#type"],
|
2455
|
+
globalInits:{jobQueue:(_,{allocPage,glbl})=>[number(allocPage(_,'promise.ts/jobQueue'),124),...glbl(36,'jobQueue',124),[65,16],[26]]},
|
2455
2456
|
}
|
2456
2457
|
this.__Porffor_promise_rejectActive = {
|
2457
|
-
wasm:()=>[[15]],
|
2458
|
+
wasm:(_,{glbl,builtin})=>[[32,0],[32,1],...glbl(35,'activePromise',124),...glbl(35,'activePromise#type',127),[16,builtin('__Porffor_promise_reject')],[68,0],[15]],
|
2458
2459
|
params:[124,127],typedParams:1,returns:[],returnType:128,
|
2459
2460
|
locals:[],localNames:["reason","reason#type"],
|
2461
|
+
globalInits:{jobQueue:(_,{allocPage,glbl})=>[number(allocPage(_,'promise.ts/jobQueue'),124),...glbl(36,'jobQueue',124),[65,16],[26]]},
|
2460
2462
|
}
|
2461
2463
|
this.Promise = {
|
2462
2464
|
wasm:(_,{t,glbl,builtin,funcRef,internalThrow})=>[[32,0],[33,6],[32,1],[33,7],[2,124],...t([67,195],()=>[[32,7],[65,195,0],[70],[32,7],[65,195,1],[70],[114],[4,64],[32,6],[252,3],[40,1,0],[69],[184],[12,1],[11]]),[32,6],[68,0],[97],[184],[11],[252,3],[4,64],...internalThrow(_,'TypeError',`Constructor Promise requires 'new'`),[26],[11],[32,5],[184],[68,6],[98],[4,64],...internalThrow(_,'TypeError',`Promise executor is not a function`),[26],[11],[16,builtin('__Porffor_promise_create')],[34,8],...glbl(36,'activePromise',124),[65,208,0],...glbl(36,'activePromise#type',127),[6,64],[32,4],[33,9],[32,5],[33,7],[2,124],...t([6],()=>[[32,7],[65,6],[70],[4,64],[68,0],[65,128,1],[68,0],[65,128,1],...funcRef('__Porffor_promise_resolveActive'),[65,6],...funcRef('__Porffor_promise_rejectActive'),[65,6],[68,0],[65,128,1],[68,0],[65,128,1],[68,0],[65,128,1],[68,0],[65,128,1],[68,0],[65,128,1],[68,0],[65,128,1],[68,0],[65,128,1],[68,0],[65,128,1],[32,9],[252,3],[17,12,0],[26],[12,1],[11]]),...internalThrow(_,'TypeError',`executor is not a function`),[68,0],[11],[26],[7,0],[33,12],[34,11],[33,13],[32,12],[33,14],[32,8],[65,208,0],[32,13],[32,14],[16,builtin('__ecma262_RejectPromise')],[11],[32,8],[15]],
|
package/compiler/codegen.js
CHANGED
@@ -588,6 +588,7 @@ const generateReturn = (scope, decl) => {
|
|
588
588
|
}
|
589
589
|
|
590
590
|
if (scope.returns.length === 0) return [
|
591
|
+
...(arg.type !== 'Identifier' ? generate(scope, arg) : []),
|
591
592
|
[ Opcodes.return ]
|
592
593
|
];
|
593
594
|
|
@@ -596,6 +597,27 @@ const generateReturn = (scope, decl) => {
|
|
596
597
|
!globalThis.precompile // skip in precompiled built-ins, we should not require this and handle it ourselves
|
597
598
|
) {
|
598
599
|
// perform return value checks for constructors and (sub)classes
|
600
|
+
|
601
|
+
// just return this if `return undefined` or `return this`
|
602
|
+
if ((arg.type === 'Identifier' && arg.name === 'undefined') || (arg.type === 'ThisExpression')) {
|
603
|
+
return [
|
604
|
+
...(scope._onlyConstr ? [] : [
|
605
|
+
[ Opcodes.local_get, scope.locals['#newtarget'].idx ],
|
606
|
+
Opcodes.i32_to_u,
|
607
|
+
[ Opcodes.if, Blocktype.void ]
|
608
|
+
]),
|
609
|
+
[ Opcodes.local_get, scope.locals['#this'].idx ],
|
610
|
+
...(scope.returnType != null ? [] : [ [ Opcodes.local_get, scope.locals['#this#type'].idx ] ]),
|
611
|
+
[ Opcodes.return ],
|
612
|
+
...(scope._onlyConstr ? [] : [
|
613
|
+
[ Opcodes.end ],
|
614
|
+
...generate(scope, arg),
|
615
|
+
...(scope.returnType != null ? [] : getNodeType(scope, arg)),
|
616
|
+
[ Opcodes.return ],
|
617
|
+
])
|
618
|
+
];
|
619
|
+
}
|
620
|
+
|
599
621
|
return [
|
600
622
|
...generate(scope, arg),
|
601
623
|
[ Opcodes.local_set, localTmp(scope, '#return') ],
|
package/package.json
CHANGED
package/r.cjs
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
function foo() {
|
2
|
+
return this;
|
3
|
+
}
|
4
|
+
|
5
|
+
console.log(foo());
|
5
6
|
|
6
|
-
console.log(a.b);
|
7
7
|
// let x = {};
|
8
8
|
// x.__proto__ = { wow() { console.log(0); } };
|
9
9
|
// Object.defineProperty(x, '__proto__', { value: { wow() { console.log(1); } } });
|