porffor 0.36.5 → 0.36.7

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.
@@ -1,26 +1,64 @@
1
- const underlyingFuncObjs: Map = new Map();
1
+ const underlyingKeys: any[] = new Array(0);
2
+ const underlyingVals: any[] = new Array(0);
2
3
  export const __Porffor_object_getObject = (obj: any): any => {
3
- if (Porffor.rawType(obj) == Porffor.TYPES.function) {
4
- const funcI32: i32 = Porffor.wasm`local.get ${obj}`;
5
- let underlying: object = underlyingFuncObjs.get(funcI32);
6
- if (underlying == null) {
7
- underlying = {};
8
-
9
- // set prototype and prototype.constructor if constructor
10
- const flags: i32 = __Porffor_funcLut_flags(funcI32);
11
- if (flags & 0b10) { // constructor
12
- const proto = {};
13
- const key1: bytestring = 'prototype';
14
- __Porffor_object_expr_initWithFlags(underlying, key1, proto, 0b1000);
15
-
16
- const key2: bytestring = 'constructor';
17
- __Porffor_object_expr_initWithFlags(proto, key2, obj, 0b1010);
4
+ const t: i32 = Porffor.rawType(obj);
5
+ if (t == Porffor.TYPES.object) return obj;
6
+
7
+ if (Porffor.fastAnd(t > 0x05, t != Porffor.TYPES.string, t != Porffor.TYPES.bytestring, t != Porffor.TYPES.undefined)) {
8
+ let idx: i32 = underlyingKeys.indexOf(obj);
9
+ if (idx == -1) {
10
+ const underlying: object = {};
11
+
12
+ if (t == Porffor.TYPES.function) {
13
+ const flags: i32 = __Porffor_funcLut_flags(obj);
14
+ if (flags & 0b10) { // constructor
15
+ // set prototype and prototype.constructor if function and constructor
16
+ const proto = {};
17
+ const key1: bytestring = 'prototype';
18
+ __Porffor_object_expr_initWithFlags(underlying, key1, proto, 0b1000);
19
+
20
+ const key2: bytestring = 'constructor';
21
+ __Porffor_object_expr_initWithFlags(proto, key2, obj, 0b1010);
22
+ }
23
+ }
24
+
25
+ Porffor.array.fastPush(underlyingVals, underlying);
26
+ idx = Porffor.array.fastPush(underlyingKeys, obj) - 1;
27
+ }
28
+
29
+ return underlyingVals[idx];
30
+ }
31
+
32
+ return obj;
33
+ };
34
+
35
+ export const __Porffor_object_makeObject = (obj: any): any => {
36
+ const t: i32 = Porffor.rawType(obj);
37
+ if (t == Porffor.TYPES.object) return obj;
38
+
39
+ if (Porffor.fastAnd(t > 0x05, t != Porffor.TYPES.string, t != Porffor.TYPES.bytestring, t != Porffor.TYPES.undefined)) {
40
+ let idx: i32 = underlyingKeys.indexOf(obj);
41
+ if (idx == -1) {
42
+ const underlying: object = {};
43
+
44
+ if (t == Porffor.TYPES.function) {
45
+ const flags: i32 = __Porffor_funcLut_flags(obj);
46
+ if (flags & 0b10) { // constructor
47
+ // set prototype and prototype.constructor if function and constructor
48
+ const proto = {};
49
+ const key1: bytestring = 'prototype';
50
+ __Porffor_object_expr_initWithFlags(underlying, key1, proto, 0b1000);
51
+
52
+ const key2: bytestring = 'constructor';
53
+ __Porffor_object_expr_initWithFlags(proto, key2, obj, 0b1010);
54
+ }
18
55
  }
19
56
 
20
- underlyingFuncObjs.set(funcI32, underlying);
57
+ Porffor.array.fastPush(underlyingVals, underlying);
58
+ idx = Porffor.array.fastPush(underlyingKeys, obj) - 1;
21
59
  }
22
60
 
23
- return underlying;
61
+ return underlyingVals[idx];
24
62
  }
25
63
 
26
64
  return obj;
@@ -18,7 +18,7 @@ import type {} from './porffor.d.ts';
18
18
 
19
19
  export const __Porffor_object_preventExtensions = (obj: any): void => {
20
20
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) {
21
- obj = __Porffor_object_getObject(obj);
21
+ obj = __Porffor_object_makeObject(obj);
22
22
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) return;
23
23
  }
24
24
 
@@ -124,7 +124,7 @@ export const __Porffor_object_accessorSet = (entryPtr: i32): Function => {
124
124
  export const __Porffor_object_lookup = (obj: any, target: any): i32 => {
125
125
  if (Porffor.wasm`local.get ${obj}` == 0) return -1;
126
126
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) {
127
- obj = __Porffor_object_getObject(obj);
127
+ obj = __Porffor_object_makeObject(obj);
128
128
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) return -1;
129
129
  }
130
130
 
@@ -171,8 +171,6 @@ export const __Porffor_object_lookup = (obj: any, target: any): i32 => {
171
171
  };
172
172
 
173
173
  export const __Porffor_object_get = (obj: any, key: any): any => {
174
- if (Porffor.wasm`local.get ${obj}` == 0) throw new TypeError('Cannot get property of null');
175
-
176
174
  const trueType: i32 = Porffor.wasm`local.get ${obj+1}`;
177
175
  if (trueType == Porffor.TYPES.function) {
178
176
  const tmp1: bytestring = 'name';
@@ -197,7 +195,10 @@ return`;
197
195
  }
198
196
  }
199
197
 
200
- if (trueType != Porffor.TYPES.object) obj = __Porffor_object_getObject(obj);
198
+ if (trueType != Porffor.TYPES.object) obj = __Porffor_object_makeObject(obj);
199
+
200
+ if (Porffor.wasm`local.get ${obj}` == 0) throw new TypeError('Cannot get property of null');
201
+
201
202
  let entryPtr: i32 = __Porffor_object_lookup(obj, key);
202
203
  if (entryPtr == -1) {
203
204
  if (Porffor.wasm`local.get ${obj+1}` == Porffor.TYPES.object) {
@@ -289,13 +290,13 @@ export const __Porffor_object_writeKey = (ptr: i32, key: any): void => {
289
290
  };
290
291
 
291
292
  export const __Porffor_object_set = (obj: any, key: any, value: any): any => {
292
- if (Porffor.wasm`local.get ${obj}` == 0) throw new TypeError('Cannot set property of null');
293
-
294
293
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) {
295
- obj = __Porffor_object_getObject(obj);
294
+ obj = __Porffor_object_makeObject(obj);
296
295
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) return value;
297
296
  }
298
297
 
298
+ if (Porffor.wasm`local.get ${obj}` == 0) throw new TypeError('Cannot set property of null');
299
+
299
300
  let entryPtr: i32 = __Porffor_object_lookup(obj, key);
300
301
  let flags: i32;
301
302
  if (entryPtr == -1) {
@@ -378,7 +379,7 @@ export const __Porffor_object_setStrict = (obj: any, key: any, value: any): any
378
379
  if (Porffor.wasm`local.get ${obj}` == 0) throw new TypeError('Cannot set property of null');
379
380
 
380
381
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) {
381
- obj = __Porffor_object_getObject(obj);
382
+ obj = __Porffor_object_makeObject(obj);
382
383
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) return value;
383
384
  }
384
385
 
@@ -462,7 +463,7 @@ export const __Porffor_object_setStrict = (obj: any, key: any, value: any): any
462
463
 
463
464
  export const __Porffor_object_define = (obj: any, key: any, value: any, flags: i32): void => {
464
465
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) {
465
- obj = __Porffor_object_getObject(obj);
466
+ obj = __Porffor_object_makeObject(obj);
466
467
  if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) return;
467
468
  }
468
469
 
@@ -699,7 +700,7 @@ export const __Porffor_object_isObjectOrSymbol = (arg: any): boolean => {
699
700
 
700
701
  // used for { foo: 5 }
701
702
  export const __Porffor_object_expr_init = (obj: any, key: any, value: any): void => {
702
- if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_getObject(obj);
703
+ if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_makeObject(obj);
703
704
  let entryPtr: i32 = __Porffor_object_lookup(obj, key);
704
705
  if (entryPtr == -1) {
705
706
  // add new entry
@@ -724,7 +725,7 @@ export const __Porffor_object_expr_init = (obj: any, key: any, value: any): void
724
725
  };
725
726
 
726
727
  export const __Porffor_object_expr_initWithFlags = (obj: any, key: any, value: any, flags: i32): void => {
727
- if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_getObject(obj);
728
+ if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_makeObject(obj);
728
729
  let entryPtr: i32 = __Porffor_object_lookup(obj, key);
729
730
  if (entryPtr == -1) {
730
731
  // add new entry
@@ -749,7 +750,7 @@ export const __Porffor_object_expr_initWithFlags = (obj: any, key: any, value: a
749
750
 
750
751
  // used for { get foo() {} }
751
752
  export const __Porffor_object_expr_get = (obj: any, key: any, get: any): void => {
752
- if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_getObject(obj);
753
+ if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_makeObject(obj);
753
754
  let entryPtr: i32 = __Porffor_object_lookup(obj, key);
754
755
  let set: any = undefined;
755
756
  if (entryPtr == -1) {
@@ -779,7 +780,7 @@ export const __Porffor_object_expr_get = (obj: any, key: any, get: any): void =>
779
780
 
780
781
  // used for { set foo(v) {} }
781
782
  export const __Porffor_object_expr_set = (obj: any, key: any, set: any): void => {
782
- if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_getObject(obj);
783
+ if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_makeObject(obj);
783
784
  let entryPtr: i32 = __Porffor_object_lookup(obj, key);
784
785
  let get: any = undefined;
785
786
  if (entryPtr == -1) {
@@ -805,4 +806,137 @@ export const __Porffor_object_expr_set = (obj: any, key: any, set: any): void =>
805
806
  Porffor.wasm.i32.store16(entryPtr,
806
807
  0b1111 + (Porffor.TYPES.number << 8),
807
808
  0, 12);
809
+ };
810
+
811
+
812
+ // used for { foo: 5 }
813
+ export const __Porffor_object_class_value = (obj: any, key: any, value: any): void => {
814
+ if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_makeObject(obj);
815
+ let entryPtr: i32 = __Porffor_object_lookup(obj, key);
816
+ if (entryPtr == -1) {
817
+ // add new entry
818
+ // check if object is inextensible
819
+ if (__Porffor_object_isInextensible(obj)) {
820
+ throw new TypeError('Cannot define property, object is inextensible');
821
+ }
822
+
823
+ // bump size +1
824
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
825
+ Porffor.wasm.i32.store(obj, size + 1, 0, 0);
826
+
827
+ // entryPtr = current end of object
828
+ entryPtr = Porffor.wasm`local.get ${obj}` + 5 + size * 14;
829
+
830
+ __Porffor_object_writeKey(entryPtr, key);
831
+ }
832
+
833
+ // write new value value (lol)
834
+ Porffor.wasm.f64.store(entryPtr, value, 0, 4);
835
+
836
+ // write new tail (value type + flags)
837
+ // flags = writable, enumerable, configurable, not accessor
838
+ Porffor.wasm.i32.store16(entryPtr,
839
+ 0b1110 + (Porffor.wasm`local.get ${value+1}` << 8),
840
+ 0, 12);
841
+ };
842
+
843
+ // used for { foo() {} }
844
+ export const __Porffor_object_class_method = (obj: any, key: any, value: any): void => {
845
+ if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_makeObject(obj);
846
+ let entryPtr: i32 = __Porffor_object_lookup(obj, key);
847
+ if (entryPtr == -1) {
848
+ // add new entry
849
+ // check if object is inextensible
850
+ if (__Porffor_object_isInextensible(obj)) {
851
+ throw new TypeError('Cannot define property, object is inextensible');
852
+ }
853
+
854
+ // bump size +1
855
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
856
+ Porffor.wasm.i32.store(obj, size + 1, 0, 0);
857
+
858
+ // entryPtr = current end of object
859
+ entryPtr = Porffor.wasm`local.get ${obj}` + 5 + size * 14;
860
+
861
+ __Porffor_object_writeKey(entryPtr, key);
862
+ }
863
+
864
+ // write new value value (lol)
865
+ Porffor.wasm.f64.store(entryPtr, value, 0, 4);
866
+
867
+ // write new tail (value type + flags)
868
+ // flags = writable, enumerable, configurable, not accessor
869
+ Porffor.wasm.i32.store16(entryPtr,
870
+ 0b1010 + (Porffor.wasm`local.get ${value+1}` << 8),
871
+ 0, 12);
872
+ };
873
+
874
+ // used for { get foo() {} }
875
+ export const __Porffor_object_class_get = (obj: any, key: any, get: any): void => {
876
+ if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_makeObject(obj);
877
+ let entryPtr: i32 = __Porffor_object_lookup(obj, key);
878
+ let set: any = undefined;
879
+ if (entryPtr == -1) {
880
+ // add new entry
881
+ // check if object is inextensible
882
+ if (__Porffor_object_isInextensible(obj)) {
883
+ throw new TypeError('Cannot define property, object is inextensible');
884
+ }
885
+
886
+ // bump size +1
887
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
888
+ Porffor.wasm.i32.store(obj, size + 1, 0, 0);
889
+
890
+ // entryPtr = current end of object
891
+ entryPtr = Porffor.wasm`local.get ${obj}` + 5 + size * 14;
892
+
893
+ __Porffor_object_writeKey(entryPtr, key);
894
+ } else {
895
+ // existing entry, keep set (if exists)
896
+ set = __Porffor_object_accessorSet(entryPtr);
897
+ }
898
+
899
+ // write new value value (lol)
900
+ Porffor.wasm.f64.store(entryPtr, __Porffor_object_packAccessor(get, set), 0, 4);
901
+
902
+ // write new tail (value type + flags)
903
+ // flags = writable, enumerable, configurable, accessor
904
+ Porffor.wasm.i32.store16(entryPtr,
905
+ 0b1011 + (Porffor.TYPES.number << 8),
906
+ 0, 12);
907
+ };
908
+
909
+ // used for { set foo(v) {} }
910
+ export const __Porffor_object_class_set = (obj: any, key: any, set: any): void => {
911
+ if (Porffor.wasm`local.get ${obj+1}` != Porffor.TYPES.object) obj = __Porffor_object_makeObject(obj);
912
+ let entryPtr: i32 = __Porffor_object_lookup(obj, key);
913
+ let get: any = undefined;
914
+ if (entryPtr == -1) {
915
+ // add new entry
916
+ // check if object is inextensible
917
+ if (__Porffor_object_isInextensible(obj)) {
918
+ throw new TypeError('Cannot define property, object is inextensible');
919
+ }
920
+
921
+ // bump size +1
922
+ const size: i32 = Porffor.wasm.i32.load(obj, 0, 0);
923
+ Porffor.wasm.i32.store(obj, size + 1, 0, 0);
924
+
925
+ // entryPtr = current end of object
926
+ entryPtr = Porffor.wasm`local.get ${obj}` + 5 + size * 14;
927
+
928
+ __Porffor_object_writeKey(entryPtr, key);
929
+ } else {
930
+ // existing entry, keep set (if exists)
931
+ get = __Porffor_object_accessorGet(entryPtr);
932
+ }
933
+
934
+ // write new value value (lol)
935
+ Porffor.wasm.f64.store(entryPtr, __Porffor_object_packAccessor(get, set), 0, 4);
936
+
937
+ // write new tail (value type + flags)
938
+ // flags = writable, enumerable, configurable, accessor
939
+ Porffor.wasm.i32.store16(entryPtr,
940
+ 0b1011 + (Porffor.TYPES.number << 8),
941
+ 0, 12);
808
942
  };
@@ -148,9 +148,13 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
148
148
 
149
149
  case Porffor.TYPES.object:
150
150
  if (arg) {
151
- Porffor.printStatic('{\n');
152
-
153
151
  const keys: any[] = Object.keys(arg);
152
+ if (keys.length == 0) {
153
+ Porffor.printStatic('{}');
154
+ return;
155
+ }
156
+
157
+ Porffor.printStatic('{ ');
154
158
  const len: i32 = keys.length - 1;
155
159
  for (let i: i32 = 0; i <= len; i++) {
156
160
  const x: any = keys[i];
@@ -164,7 +168,7 @@ export const __Porffor_print = (arg: any, colors: boolean = true) => {
164
168
  if (i != len) Porffor.printStatic(',\n');
165
169
  }
166
170
 
167
- Porffor.printStatic('\n}');
171
+ Porffor.printStatic(' }');
168
172
  } else {
169
173
  if (colors) Porffor.printStatic('\x1b[1m'); // bold
170
174
  Porffor.printStatic('null');
@@ -18,7 +18,6 @@ export const __Object_keys = (obj: any): any[] => {
18
18
  if (obj == null) throw new TypeError('Argument is nullish, expected object');
19
19
  const out: any[] = Porffor.allocate();
20
20
 
21
- obj = __Porffor_object_getObject(obj);
22
21
  const t: i32 = Porffor.rawType(obj);
23
22
  if (t == Porffor.TYPES.object) {
24
23
  let ptr: i32 = Porffor.wasm`local.get ${obj}` + 5;
@@ -65,16 +64,24 @@ local.set ${key}`;
65
64
  }
66
65
 
67
66
  out.length = i;
68
- } else if (Porffor.fastOr(
69
- t == Porffor.TYPES.array,
70
- t == Porffor.TYPES.bytestring,
71
- t == Porffor.TYPES.string
72
- )) {
73
- const len: i32 = obj.length;
74
- out.length = len;
67
+ } else {
68
+ if (Porffor.fastOr(
69
+ t == Porffor.TYPES.array,
70
+ t == Porffor.TYPES.bytestring,
71
+ t == Porffor.TYPES.string
72
+ )) {
73
+ const len: i32 = obj.length;
74
+ out.length = len;
75
+
76
+ for (let i: i32 = 0; i < len; i++) {
77
+ out[i] = __Number_prototype_toString(i);
78
+ }
79
+ }
75
80
 
76
- for (let i: i32 = 0; i < len; i++) {
77
- out[i] = __Number_prototype_toString(i);
81
+ obj = __Porffor_object_makeObject(obj);
82
+ if (Porffor.rawType(obj) == Porffor.TYPES.object) {
83
+ const objKeys: any[] = __Object_keys(obj);
84
+ for (const x of objKeys) Porffor.array.fastPush(out, x);
78
85
  }
79
86
  }
80
87
 
@@ -85,7 +92,6 @@ export const __Object_values = (obj: any): any[] => {
85
92
  if (obj == null) throw new TypeError('Argument is nullish, expected object');
86
93
  const out: any[] = Porffor.allocate();
87
94
 
88
- obj = __Porffor_object_getObject(obj);
89
95
  const t: i32 = Porffor.rawType(obj);
90
96
  if (t == Porffor.TYPES.object) {
91
97
  let ptr: i32 = Porffor.wasm`local.get ${obj}` + 5;
@@ -112,16 +118,24 @@ local.set ${val+1}`;
112
118
  }
113
119
 
114
120
  out.length = i;
115
- } else if (Porffor.fastOr(
116
- t == Porffor.TYPES.array,
117
- t == Porffor.TYPES.bytestring,
118
- t == Porffor.TYPES.string
119
- )) {
120
- const len: i32 = obj.length;
121
- out.length = len;
121
+ } else {
122
+ if (Porffor.fastOr(
123
+ t == Porffor.TYPES.array,
124
+ t == Porffor.TYPES.bytestring,
125
+ t == Porffor.TYPES.string
126
+ )) {
127
+ const len: i32 = obj.length;
128
+ out.length = len;
129
+
130
+ for (let i: i32 = 0; i < len; i++) {
131
+ out[i] = obj[i];
132
+ }
133
+ }
122
134
 
123
- for (let i: i32 = 0; i < len; i++) {
124
- out[i] = obj[i];
135
+ obj = __Porffor_object_makeObject(obj);
136
+ if (Porffor.rawType(obj) == Porffor.TYPES.object) {
137
+ const objVals: any[] = __Object_values(obj);
138
+ for (const x of objVals) Porffor.array.fastPush(out, x);
125
139
  }
126
140
  }
127
141
 
@@ -181,6 +195,11 @@ export const __Object_prototype_hasOwnProperty = (_this: any, prop: any) => {
181
195
  return Porffor.object.lookup(_this, p) != -1;
182
196
  }
183
197
 
198
+ const obj: any = __Porffor_object_makeObject(_this);
199
+ if (Porffor.rawType(obj) == Porffor.TYPES.object) {
200
+ if (Porffor.object.lookup(obj, p) != -1) return true;
201
+ }
202
+
184
203
  const keys: any[] = __Object_keys(_this);
185
204
  return __Array_prototype_includes(keys, p);
186
205
  };
@@ -262,14 +281,19 @@ export const __Porffor_object_assignAll = (target: any, source: any) => {
262
281
  export const __Object_prototype_propertyIsEnumerable = (_this: any, prop: any) => {
263
282
  const p: any = ecma262.ToPropertyKey(prop);
264
283
 
265
- const obj: any = __Porffor_object_getObject(_this);
266
- if (Porffor.rawType(obj) == Porffor.TYPES.object) {
284
+ if (Porffor.rawType(_this) == Porffor.TYPES.object) {
267
285
  const entryPtr: i32 = Porffor.object.lookup(_this, p);
268
286
  if (entryPtr == -1) return false;
269
287
 
270
288
  return Porffor.object.isEnumerable(entryPtr);
271
289
  }
272
290
 
291
+ const obj: any = __Porffor_object_makeObject(_this);
292
+ if (Porffor.rawType(obj) == Porffor.TYPES.object) {
293
+ const entryPtr: i32 = Porffor.object.lookup(obj, p);
294
+ if (entryPtr != -1) return Porffor.object.isEnumerable(entryPtr);
295
+ }
296
+
273
297
  const keys: any[] = __Object_keys(_this);
274
298
  return __Array_prototype_includes(keys, p);
275
299
  };
@@ -413,7 +437,7 @@ export const __Object_getOwnPropertyDescriptors = (obj: any): any => {
413
437
  const out: object = {};
414
438
 
415
439
  if (Porffor.rawType(obj) != Porffor.TYPES.object) {
416
- obj = __Porffor_object_getObject(obj);
440
+ obj = __Porffor_object_makeObject(obj);
417
441
  if (Porffor.rawType(obj) != Porffor.TYPES.object) return out;
418
442
  }
419
443
 
@@ -475,16 +499,24 @@ local.set ${key}`;
475
499
  }
476
500
 
477
501
  out.length = i;
478
- } else if (Porffor.fastOr(
479
- t == Porffor.TYPES.array,
480
- t == Porffor.TYPES.bytestring,
481
- t == Porffor.TYPES.string
482
- )) {
483
- const len: i32 = obj.length;
484
- out.length = len;
502
+ } else {
503
+ if (Porffor.fastOr(
504
+ t == Porffor.TYPES.array,
505
+ t == Porffor.TYPES.bytestring,
506
+ t == Porffor.TYPES.string
507
+ )) {
508
+ const len: i32 = obj.length;
509
+ out.length = len;
510
+
511
+ for (let i: i32 = 0; i < len; i++) {
512
+ out[i] = __Number_prototype_toString(i);
513
+ }
514
+ }
485
515
 
486
- for (let i: i32 = 0; i < len; i++) {
487
- out[i] = __Number_prototype_toString(i);
516
+ obj = __Porffor_object_makeObject(obj);
517
+ if (Porffor.rawType(obj) == Porffor.TYPES.object) {
518
+ const objKeys: any[] = __Object_getOwnPropertyNames(obj);
519
+ for (const x of objKeys) Porffor.array.fastPush(out, x);
488
520
  }
489
521
  }
490
522
 
@@ -495,6 +527,7 @@ export const __Object_getOwnPropertySymbols = (obj: any): any[] => {
495
527
  if (obj == null) throw new TypeError('Argument is nullish, expected object');
496
528
  const out: any[] = Porffor.allocate();
497
529
 
530
+ obj = __Porffor_object_makeObject(obj);
498
531
  const t: i32 = Porffor.rawType(obj);
499
532
  if (t == Porffor.TYPES.object) {
500
533
  let ptr: i32 = Porffor.wasm`local.get ${obj}` + 5;
@@ -132,16 +132,24 @@ local.set ${key}`;
132
132
  }
133
133
 
134
134
  out.length = i;
135
- } else if (Porffor.fastOr(
136
- t == Porffor.TYPES.array,
137
- t == Porffor.TYPES.bytestring,
138
- t == Porffor.TYPES.string
139
- )) {
140
- const len: i32 = target.length;
141
- out.length = len;
142
-
143
- for (let i: i32 = 0; i < len; i++) {
144
- out[i] = __Number_prototype_toString(i);
135
+ } else {
136
+ if (Porffor.fastOr(
137
+ t == Porffor.TYPES.array,
138
+ t == Porffor.TYPES.bytestring,
139
+ t == Porffor.TYPES.string
140
+ )) {
141
+ const len: i32 = obj.length;
142
+ out.length = len;
143
+
144
+ for (let i: i32 = 0; i < len; i++) {
145
+ out[i] = __Number_prototype_toString(i);
146
+ }
147
+ }
148
+
149
+ target = __Porffor_object_getObject(target);
150
+ if (Porffor.rawType(target) == Porffor.TYPES.object) {
151
+ const objKeys: any[] = __Reflect_ownKeys(target);
152
+ for (const x of objKeys) Porffor.array.fastPush(out, x);
145
153
  }
146
154
  }
147
155