porffor 0.28.10 → 0.28.11

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.
@@ -102,6 +102,8 @@ export const __Porffor_object_accessorSet = (entryPtr: i32): Function => {
102
102
 
103
103
 
104
104
  export const __Porffor_object_lookup = (obj: object, target: any): i32 => {
105
+ if (Porffor.wasm`local.get ${obj}` == 0) return -1;
106
+
105
107
  const targetType: i32 = Porffor.wasm`local.get ${target+1}`;
106
108
 
107
109
  let ptr: i32 = Porffor.wasm`local.get ${obj}` + 5;
@@ -145,6 +147,8 @@ export const __Porffor_object_lookup = (obj: object, target: any): i32 => {
145
147
  };
146
148
 
147
149
  export const __Porffor_object_get = (obj: any, key: any): any => {
150
+ if (Porffor.wasm`local.get ${obj}` == 0) throw new TypeError('Cannot get property of null');
151
+
148
152
  if (Porffor.wasm`local.get ${obj+1}` == Porffor.TYPES.function) {
149
153
  let tmp: bytestring = '';
150
154
  tmp = 'name';
@@ -241,6 +245,8 @@ export const __Porffor_object_writeKey = (ptr: i32, key: any): void => {
241
245
  };
242
246
 
243
247
  export const __Porffor_object_set = (obj: object, key: any, value: any): any => {
248
+ if (Porffor.wasm`local.get ${obj}` == 0) throw new TypeError('Cannot set property of null');
249
+
244
250
  let entryPtr: i32 = __Porffor_object_lookup(obj, key);
245
251
  let flags: i32;
246
252
  if (entryPtr == -1) {
@@ -45,13 +45,13 @@ export const BuiltinFuncs = function() {
45
45
  locals: [127], localNames: ["entryPtr","entryPtr#type","out"],
46
46
  };
47
47
  this.__Porffor_object_lookup = {
48
- wasm: (scope, {}) => [[32,3],[33,4],[32,0],[65,5],[106],[33,5],[32,0],[40,0,0],[33,6],[32,5],[32,6],[65,14],[108],[106],[33,7],[32,4],[65,195,1],[70],[4,64],[32,2],[33,8],[3,64],[32,5],[32,7],[72],[4,64],[2,64],[32,5],[40,0,0],[34,9],[69],[4,64],[12,2],[11],[32,9],[65,31],[118],[4,64],[12,1],[11],[32,9],[34,10],[32,8],[33,13],[34,11],[32,13],[71],[4,127],[32,11],[40,0,0],[34,12],[32,13],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,14],[32,12],[33,15],[3,64],[32,14],[32,11],[106],[45,0,4],[32,14],[32,13],[106],[45,0,4],[71],[4,64],[65,0],[12,2],[11],[32,14],[65,1],[106],[34,14],[32,15],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,5],[65,1],[15],[11],[11],[32,5],[65,14],[106],[34,5],[12,1],[11],[11],[5],[32,4],[65,195,0],[70],[4,64],[32,2],[33,8],[3,64],[32,5],[32,7],[72],[4,64],[2,64],[32,5],[40,0,0],[34,9],[69],[4,64],[12,2],[11],[32,9],[65,30],[118],[65,2],[70],[4,64],[32,9],[65,255,255,255,255,7],[113],[34,10],[32,8],[33,13],[34,11],[32,13],[71],[4,127],[32,11],[40,0,0],[34,12],[32,13],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,14],[32,12],[65,2],[108],[33,15],[3,64],[32,14],[32,11],[106],[47,0,4],[32,14],[32,13],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,14],[65,2],[106],[34,14],[32,15],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,5],[65,1],[15],[11],[11],[11],[32,5],[65,14],[106],[34,5],[12,1],[11],[11],[5],[32,2],[33,16],[3,64],[32,5],[32,7],[72],[4,64],[2,64],[32,5],[40,0,0],[34,9],[69],[4,64],[12,2],[11],[32,9],[65,30],[118],[65,3],[70],[4,64],[32,9],[65,255,255,255,255,3],[113],[34,17],[32,16],[70],[4,64],[32,5],[65,1],[15],[11],[11],[11],[32,5],[65,14],[106],[34,5],[12,1],[11],[11],[11],[11],[65,127],[65,1],[15]],
48
+ wasm: (scope, {}) => [[32,0],[69],[4,64],[65,127],[65,1],[15],[11],[32,3],[33,4],[32,0],[65,5],[106],[33,5],[32,0],[40,0,0],[33,6],[32,5],[32,6],[65,14],[108],[106],[33,7],[32,4],[65,195,1],[70],[4,64],[32,2],[33,8],[3,64],[32,5],[32,7],[72],[4,64],[2,64],[32,5],[40,0,0],[34,9],[69],[4,64],[12,2],[11],[32,9],[65,31],[118],[4,64],[12,1],[11],[32,9],[34,10],[32,8],[33,13],[34,11],[32,13],[71],[4,127],[32,11],[40,0,0],[34,12],[32,13],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,14],[32,12],[33,15],[3,64],[32,14],[32,11],[106],[45,0,4],[32,14],[32,13],[106],[45,0,4],[71],[4,64],[65,0],[12,2],[11],[32,14],[65,1],[106],[34,14],[32,15],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,5],[65,1],[15],[11],[11],[32,5],[65,14],[106],[34,5],[12,1],[11],[11],[5],[32,4],[65,195,0],[70],[4,64],[32,2],[33,8],[3,64],[32,5],[32,7],[72],[4,64],[2,64],[32,5],[40,0,0],[34,9],[69],[4,64],[12,2],[11],[32,9],[65,30],[118],[65,2],[70],[4,64],[32,9],[65,255,255,255,255,7],[113],[34,10],[32,8],[33,13],[34,11],[32,13],[71],[4,127],[32,11],[40,0,0],[34,12],[32,13],[40,0,0],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,14],[32,12],[65,2],[108],[33,15],[3,64],[32,14],[32,11],[106],[47,0,4],[32,14],[32,13],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,14],[65,2],[106],[34,14],[32,15],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,5],[65,1],[15],[11],[11],[11],[32,5],[65,14],[106],[34,5],[12,1],[11],[11],[5],[32,2],[33,16],[3,64],[32,5],[32,7],[72],[4,64],[2,64],[32,5],[40,0,0],[34,9],[69],[4,64],[12,2],[11],[32,9],[65,30],[118],[65,3],[70],[4,64],[32,9],[65,255,255,255,255,3],[113],[34,17],[32,16],[70],[4,64],[32,5],[65,1],[15],[11],[11],[11],[32,5],[65,14],[106],[34,5],[12,1],[11],[11],[11],[11],[65,127],[65,1],[15]],
49
49
  params: [127,127,127,127], typedParams: 1,
50
50
  returns: [127,127], typedReturns: 1,
51
51
  locals: [127,127,127,127,127,127,127,127,127,127,127,127,127,127], localNames: ["obj","obj#type","target","target#type","targetType","ptr","size","endPtr","targetStr","keyRaw","keyStr","compare_left_pointer","compare_left_length","compare_right_pointer","compare_index","compare_index_end","targetSym","keySym"],
52
52
  };
53
53
  this.__Porffor_object_get = {
54
- wasm: (scope, {allocPage,builtin}) => [[32,1],[65,6],[70],[4,64],...number(allocPage(scope, 'bytestring: __Porffor_object_get/tmp', 'i8') * pageSize, 127),[34,4],[34,5],[65,4],[54,1,0],[32,5],[65,238,0],[58,0,4],[32,5],[65,225,0],[58,0,5],[32,5],[65,237,0],[58,0,6],[32,5],[65,229,0],[58,0,7],[32,5],[33,4],[32,2],[32,4],[33,8],[34,6],[32,8],[71],[4,127],[32,6],[40,0,0],[34,7],[32,8],[40,0,0],[32,3],[65,195,1],[70],[4,64],[32,6],[32,7],[16, builtin('__Porffor_bytestringToString')],[33,6],[11],[65,195,1],[65,195,1],[70],[4,64],[32,8],[32,8],[40,0,0],[16, builtin('__Porffor_bytestringToString')],[33,8],[11],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,9],[32,7],[65,2],[108],[33,10],[3,64],[32,9],[32,6],[106],[47,0,4],[32,9],[32,8],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,9],[65,2],[106],[34,9],[32,10],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,0],[16, builtin('__Porffor_funcLut_name')],[33,11],[65,195,1],[33,12],[32,11],[184],[32,12],[15],[11],[32,4],[34,5],[65,6],[54,1,0],[32,5],[65,236,0],[58,0,4],[32,5],[65,229,0],[58,0,5],[32,5],[65,238,0],[58,0,6],[32,5],[65,231,0],[58,0,7],[32,5],[65,244,0],[58,0,8],[32,5],[65,232,0],[58,0,9],[32,5],[33,4],[32,2],[32,4],[33,8],[34,6],[32,8],[71],[4,127],[32,6],[40,0,0],[34,7],[32,8],[40,0,0],[32,3],[65,195,1],[70],[4,64],[32,6],[32,7],[16, builtin('__Porffor_bytestringToString')],[33,6],[11],[65,195,1],[65,195,1],[70],[4,64],[32,8],[32,8],[40,0,0],[16, builtin('__Porffor_bytestringToString')],[33,8],[11],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,9],[32,7],[65,2],[108],[33,10],[3,64],[32,9],[32,6],[106],[47,0,4],[32,9],[32,8],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,9],[65,2],[106],[34,9],[32,10],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,0],[16, builtin('__Porffor_funcLut_length')],[34,11],[184],[65,1],[15],[11],[68,0,0,0,0,0,0,0,0],[65,128,1],[15],[11],[32,0],[32,1],[32,2],[32,3],[16, builtin('__Porffor_object_lookup')],[26],[34,13],[65,127],[70],[4,64],[68,0,0,0,0,0,0,0,0],[65,128,1],[15],[11],[32,13],[47,0,12],[34,15],[65,1],[113],[4,64],[32,13],[65,1],[16, builtin('__Porffor_object_accessorGet')],[26],[34,16],[69],[4,64],[68,0,0,0,0,0,0,0,0],[65,128,1],[15],[11],[32,16],[16, builtin('__Porffor_funcLut_flags')],[34,17],[65,2],[113],[4,64],[68,0,0,0,0,0,0,0,0],[65,0],[32,0],[184],[32,1],[32,16],[17,2,0],[15],[5],[32,16],[17,0,0],[15],[11],[11],[32,13],[43,0,4],[32,15],[65,8],[118],[15]],
54
+ wasm: (scope, {allocPage,builtin,internalThrow}) => [[32,0],[69],[4,64],...internalThrow(scope, 'TypeError', `Cannot get property of null`),[11],[32,1],[65,6],[70],[4,64],...number(allocPage(scope, 'bytestring: __Porffor_object_get/tmp', 'i8') * pageSize, 127),[34,4],[34,5],[65,4],[54,1,0],[32,5],[65,238,0],[58,0,4],[32,5],[65,225,0],[58,0,5],[32,5],[65,237,0],[58,0,6],[32,5],[65,229,0],[58,0,7],[32,5],[33,4],[32,2],[32,4],[33,8],[34,6],[32,8],[71],[4,127],[32,6],[40,0,0],[34,7],[32,8],[40,0,0],[32,3],[65,195,1],[70],[4,64],[32,6],[32,7],[16, builtin('__Porffor_bytestringToString')],[33,6],[11],[65,195,1],[65,195,1],[70],[4,64],[32,8],[32,8],[40,0,0],[16, builtin('__Porffor_bytestringToString')],[33,8],[11],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,9],[32,7],[65,2],[108],[33,10],[3,64],[32,9],[32,6],[106],[47,0,4],[32,9],[32,8],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,9],[65,2],[106],[34,9],[32,10],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,0],[16, builtin('__Porffor_funcLut_name')],[33,11],[65,195,1],[33,12],[32,11],[184],[32,12],[15],[11],[32,4],[34,5],[65,6],[54,1,0],[32,5],[65,236,0],[58,0,4],[32,5],[65,229,0],[58,0,5],[32,5],[65,238,0],[58,0,6],[32,5],[65,231,0],[58,0,7],[32,5],[65,244,0],[58,0,8],[32,5],[65,232,0],[58,0,9],[32,5],[33,4],[32,2],[32,4],[33,8],[34,6],[32,8],[71],[4,127],[32,6],[40,0,0],[34,7],[32,8],[40,0,0],[32,3],[65,195,1],[70],[4,64],[32,6],[32,7],[16, builtin('__Porffor_bytestringToString')],[33,6],[11],[65,195,1],[65,195,1],[70],[4,64],[32,8],[32,8],[40,0,0],[16, builtin('__Porffor_bytestringToString')],[33,8],[11],[71],[4,64],[65,0],[12,1],[11],[65,0],[33,9],[32,7],[65,2],[108],[33,10],[3,64],[32,9],[32,6],[106],[47,0,4],[32,9],[32,8],[106],[47,0,4],[71],[4,64],[65,0],[12,2],[11],[32,9],[65,2],[106],[34,9],[32,10],[72],[13,0],[11],[65,1],[5],[65,1],[11],[4,64],[32,0],[16, builtin('__Porffor_funcLut_length')],[34,11],[184],[65,1],[15],[11],[68,0,0,0,0,0,0,0,0],[65,128,1],[15],[11],[32,0],[32,1],[32,2],[32,3],[16, builtin('__Porffor_object_lookup')],[26],[34,13],[65,127],[70],[4,64],[68,0,0,0,0,0,0,0,0],[65,128,1],[15],[11],[32,13],[47,0,12],[34,15],[65,1],[113],[4,64],[32,13],[65,1],[16, builtin('__Porffor_object_accessorGet')],[26],[34,16],[69],[4,64],[68,0,0,0,0,0,0,0,0],[65,128,1],[15],[11],[32,16],[16, builtin('__Porffor_funcLut_flags')],[34,17],[65,2],[113],[4,64],[68,0,0,0,0,0,0,0,0],[65,0],[32,0],[184],[32,1],[32,16],[17,2,0],[15],[5],[32,16],[17,0,0],[15],[11],[11],[32,13],[43,0,4],[32,15],[65,8],[118],[15]],
55
55
  params: [127,127,127,127], typedParams: 1,
56
56
  returns: [124,127], typedReturns: 1,
57
57
  locals: [127,127,127,127,127,127,127,127,127,127,127,127,127,127], localNames: ["obj","obj#type","key","key#type","tmp","#makearray_pointer_tmp","compare_left_pointer","compare_left_length","compare_right_pointer","compare_index","compare_index_end","o","t","entryPtr","#last_type","tail","get","funcFlags"],
@@ -63,7 +63,7 @@ export const BuiltinFuncs = function() {
63
63
  locals: [127], localNames: ["ptr","ptr#type","key","key#type","keyEnc"],
64
64
  };
65
65
  this.__Porffor_object_set = {
66
- wasm: (scope, {builtin}) => [[32,0],[65,7],[32,2],[32,3],[16, builtin('__Porffor_object_lookup')],[26],[34,6],[65,127],[70],[4,64],[32,0],[65,7],[16, builtin('__Porffor_object_isInextensible')],[33,7],[33,9],[32,7],[33,10],[2,127],[32,10],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,9],[40,1,0],[12,1],[11],[32,10],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,9],[40,1,0],[12,1],[11],[32,9],[11,"TYPESWITCH_end"],[4,64],[32,4],[32,5],[15],[11],[32,0],[40,0,0],[33,11],[32,0],[32,11],[65,1],[106],[54,0,0],[32,0],[65,5],[106],[32,11],[65,14],[108],[106],[34,6],[65,1],[32,2],[32,3],[16, builtin('__Porffor_object_writeKey')],[33,7],[26],[65,14],[33,8],[5],[32,6],[47,0,12],[34,12],[65,1],[113],[4,64],[32,6],[65,1],[16, builtin('__Porffor_object_accessorSet')],[26],[34,13],[69],[4,64],[32,4],[32,5],[15],[11],[32,13],[16, builtin('__Porffor_funcLut_flags')],[34,14],[65,2],[113],[4,64],[68,0,0,0,0,0,0,0,0],[65,0],[32,0],[184],[65,7],[32,4],[32,5],[32,13],[17,3,0],[26],[26],[5],[32,4],[32,5],[32,13],[17,1,0],[26],[26],[11],[32,4],[32,5],[15],[11],[32,12],[65,8],[113],[69],[4,64],[32,4],[32,5],[15],[11],[32,12],[65,255,1],[113],[33,8],[11],[32,6],[32,4],[57,0,4],[32,6],[32,8],[32,5],[65,8],[116],[106],[59,0,12],[32,4],[32,5],[15]],
66
+ wasm: (scope, {builtin,internalThrow}) => [[32,0],[69],[4,64],...internalThrow(scope, 'TypeError', `Cannot set property of null`),[11],[32,0],[65,7],[32,2],[32,3],[16, builtin('__Porffor_object_lookup')],[26],[34,6],[65,127],[70],[4,64],[32,0],[65,7],[16, builtin('__Porffor_object_isInextensible')],[33,7],[33,9],[32,7],[33,10],[2,127],[32,10],[65,195,0],[70],[4,64,"TYPESWITCH|String"],[32,9],[40,1,0],[12,1],[11],[32,10],[65,195,1],[70],[4,64,"TYPESWITCH|ByteString"],[32,9],[40,1,0],[12,1],[11],[32,9],[11,"TYPESWITCH_end"],[4,64],[32,4],[32,5],[15],[11],[32,0],[40,0,0],[33,11],[32,0],[32,11],[65,1],[106],[54,0,0],[32,0],[65,5],[106],[32,11],[65,14],[108],[106],[34,6],[65,1],[32,2],[32,3],[16, builtin('__Porffor_object_writeKey')],[33,7],[26],[65,14],[33,8],[5],[32,6],[47,0,12],[34,12],[65,1],[113],[4,64],[32,6],[65,1],[16, builtin('__Porffor_object_accessorSet')],[26],[34,13],[69],[4,64],[32,4],[32,5],[15],[11],[32,13],[16, builtin('__Porffor_funcLut_flags')],[34,14],[65,2],[113],[4,64],[68,0,0,0,0,0,0,0,0],[65,0],[32,0],[184],[65,7],[32,4],[32,5],[32,13],[17,3,0],[26],[26],[5],[32,4],[32,5],[32,13],[17,1,0],[26],[26],[11],[32,4],[32,5],[15],[11],[32,12],[65,8],[113],[69],[4,64],[32,4],[32,5],[15],[11],[32,12],[65,255,1],[113],[33,8],[11],[32,6],[32,4],[57,0,4],[32,6],[32,8],[32,5],[65,8],[116],[106],[59,0,12],[32,4],[32,5],[15]],
67
67
  params: [127,127,127,127,124,127], typedParams: 1,
68
68
  returns: [124,127], typedReturns: 1,
69
69
  locals: [127,127,127,127,127,127,127,127,127], localNames: ["obj","obj#type","key","key#type","value","value#type","entryPtr","#last_type","flags","#logicinner_tmp","#typeswitch_tmp1","size","tail","set","funcFlags"],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
4
- "version": "0.28.10+83363f3c5",
4
+ "version": "0.28.11+95f766485",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.28.10+83363f3c5';
3
+ globalThis.version = '0.28.11+95f766485';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {