porffor 0.18.7 → 0.18.8
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.
@@ -5,7 +5,7 @@ export const __String_prototype_trimLeft = (_this: string) => {
|
|
5
5
|
return __String_prototype_trimStart(_this);
|
6
6
|
};
|
7
7
|
|
8
|
-
export const __ByteString_prototype_trimLeft = (_this:
|
8
|
+
export const __ByteString_prototype_trimLeft = (_this: bytestring) => {
|
9
9
|
return __ByteString_prototype_trimStart(_this);
|
10
10
|
};
|
11
11
|
|
@@ -14,6 +14,6 @@ export const __String_prototype_trimRight = (_this: string) => {
|
|
14
14
|
return __String_prototype_trimEnd(_this);
|
15
15
|
};
|
16
16
|
|
17
|
-
export const __ByteString_prototype_trimRight = (_this:
|
17
|
+
export const __ByteString_prototype_trimRight = (_this: bytestring) => {
|
18
18
|
return __ByteString_prototype_trimEnd(_this);
|
19
19
|
};
|
@@ -46,73 +46,6 @@ export const __Array_prototype_slice = (_this: any[], start: number, end: number
|
|
46
46
|
return out;
|
47
47
|
};
|
48
48
|
|
49
|
-
export const __Array_prototype_splice = (_this: any[], index: any, deleteCount: any, ...values: any[]) => {
|
50
|
-
const len: i32 = _this.length;
|
51
|
-
|
52
|
-
if (Porffor.rawType(index) == Porffor.TYPES.undefined) index = len;
|
53
|
-
index |= 0;
|
54
|
-
if (index < 0) {
|
55
|
-
index = len + index;
|
56
|
-
if (index < 0) index = 0;
|
57
|
-
}
|
58
|
-
|
59
|
-
if (Porffor.rawType(deleteCount) == Porffor.TYPES.undefined) deleteCount = 1;
|
60
|
-
deleteCount |= 0;
|
61
|
-
if (deleteCount < 0) deleteCount = 0;
|
62
|
-
if (deleteCount > len - index) deleteCount = len - index;
|
63
|
-
|
64
|
-
const out: any[] = Porffor.allocate();
|
65
|
-
out.length = deleteCount;
|
66
|
-
|
67
|
-
for (let i: i32 = 0; i < deleteCount; i++) {
|
68
|
-
out[i] = _this[index + i];
|
69
|
-
}
|
70
|
-
|
71
|
-
_this.length = len - deleteCount;
|
72
|
-
|
73
|
-
// memory.copy lol
|
74
|
-
Porffor.wasm`
|
75
|
-
;; dst = ptr(this) + index * sizeof element + sizeof length
|
76
|
-
local.get ${_this}
|
77
|
-
i32.to_u
|
78
|
-
local.get ${index}
|
79
|
-
i32.to_u
|
80
|
-
i32.const 9
|
81
|
-
i32.mul
|
82
|
-
i32.add
|
83
|
-
i32.const 4
|
84
|
-
i32.add
|
85
|
-
|
86
|
-
local #splice_ptr i32
|
87
|
-
local.tee #splice_ptr
|
88
|
-
|
89
|
-
;; src = dst + deletecount * sizeof element
|
90
|
-
local.get #splice_ptr
|
91
|
-
local.get ${deleteCount}
|
92
|
-
i32.to_u
|
93
|
-
i32.const 9
|
94
|
-
i32.mul
|
95
|
-
i32.add
|
96
|
-
|
97
|
-
;; size = (length - deleteCount - index) * sizeof element
|
98
|
-
local.get ${len}
|
99
|
-
i32.to_u
|
100
|
-
local.get ${deleteCount}
|
101
|
-
i32.to_u
|
102
|
-
i32.sub
|
103
|
-
local.get ${index}
|
104
|
-
i32.to_u
|
105
|
-
i32.sub
|
106
|
-
i32.const 9
|
107
|
-
i32.mul
|
108
|
-
|
109
|
-
memory.copy 0 0`;
|
110
|
-
|
111
|
-
return out;
|
112
|
-
};
|
113
|
-
|
114
|
-
// todo: unshift
|
115
|
-
|
116
49
|
// @porf-typed-array
|
117
50
|
export const __Array_prototype_fill = (_this: any[], value: any, start: any, end: any) => {
|
118
51
|
const len: i32 = _this.length;
|
@@ -192,7 +192,7 @@ export const BuiltinFuncs = function() {
|
|
192
192
|
localNames: ["_this","_this#type","#last_type"],
|
193
193
|
};
|
194
194
|
this.__ByteString_prototype_trimLeft = {
|
195
|
-
wasm: (scope, {builtin,}) => [[32,0],[65,
|
195
|
+
wasm: (scope, {builtin,}) => [[32,0],[65,210,0],[16, builtin('__ByteString_prototype_trimStart')],[34,2],[15]],
|
196
196
|
params: [127,127],
|
197
197
|
typedParams: true,
|
198
198
|
returns: [127,127],
|
@@ -210,7 +210,7 @@ export const BuiltinFuncs = function() {
|
|
210
210
|
localNames: ["_this","_this#type","#last_type"],
|
211
211
|
};
|
212
212
|
this.__ByteString_prototype_trimRight = {
|
213
|
-
wasm: (scope, {builtin,}) => [[32,0],[65,
|
213
|
+
wasm: (scope, {builtin,}) => [[32,0],[65,210,0],[16, builtin('__ByteString_prototype_trimEnd')],[34,2],[15]],
|
214
214
|
params: [127,127],
|
215
215
|
typedParams: true,
|
216
216
|
returns: [127,127],
|
package/package.json
CHANGED