goscript 0.0.24 → 0.0.25
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/README.md +1 -1
- package/cmd/goscript/cmd_compile.go +17 -1
- package/compiler/analysis.go +1 -1
- package/compiler/builtin_test.go +2 -14
- package/compiler/compiler.go +231 -11
- package/compiler/decl.go +7 -1
- package/compiler/expr-call.go +212 -2
- package/compiler/expr.go +46 -2
- package/compiler/field.go +4 -4
- package/compiler/stmt-range.go +204 -1
- package/compiler/type.go +47 -4
- package/dist/gs/builtin/builtin.d.ts +9 -0
- package/dist/gs/builtin/builtin.js +9 -0
- package/dist/gs/builtin/builtin.js.map +1 -1
- package/dist/gs/builtin/channel.d.ts +193 -0
- package/dist/gs/builtin/channel.js.map +1 -1
- package/dist/gs/builtin/defer.d.ts +38 -0
- package/dist/gs/builtin/defer.js.map +1 -1
- package/dist/gs/builtin/index.d.ts +1 -0
- package/dist/gs/builtin/index.js +2 -0
- package/dist/gs/builtin/index.js.map +1 -0
- package/dist/gs/builtin/io.d.ts +16 -0
- package/dist/gs/builtin/io.js.map +1 -1
- package/dist/gs/builtin/map.d.ts +33 -0
- package/dist/gs/builtin/map.js.map +1 -1
- package/dist/gs/builtin/slice.d.ts +173 -0
- package/dist/gs/builtin/slice.js.map +1 -1
- package/dist/gs/builtin/type.d.ts +203 -0
- package/dist/gs/builtin/type.js +1 -2
- package/dist/gs/builtin/type.js.map +1 -1
- package/dist/gs/builtin/varRef.d.ts +14 -0
- package/dist/gs/builtin/varRef.js.map +1 -1
- package/dist/gs/cmp/index.d.ts +4 -0
- package/dist/gs/cmp/index.js +27 -0
- package/dist/gs/cmp/index.js.map +1 -0
- package/dist/gs/context/context.d.ts +26 -0
- package/dist/gs/context/context.js +287 -37
- package/dist/gs/context/context.js.map +1 -1
- package/dist/gs/context/index.d.ts +1 -0
- package/dist/gs/internal/goarch/index.d.ts +6 -0
- package/dist/gs/internal/goarch/index.js +14 -0
- package/dist/gs/internal/goarch/index.js.map +1 -0
- package/dist/gs/iter/index.d.ts +1 -0
- package/dist/gs/iter/index.js +2 -0
- package/dist/gs/iter/index.js.map +1 -0
- package/dist/gs/iter/iter.d.ts +4 -0
- package/dist/gs/iter/iter.js +91 -0
- package/dist/gs/iter/iter.js.map +1 -0
- package/dist/gs/math/bits/index.d.ts +47 -0
- package/dist/gs/math/bits/index.js +298 -0
- package/dist/gs/math/bits/index.js.map +1 -0
- package/dist/gs/runtime/index.d.ts +1 -0
- package/dist/gs/runtime/runtime.d.ts +41 -0
- package/dist/gs/runtime/runtime.js.map +1 -1
- package/dist/gs/slices/index.d.ts +1 -0
- package/dist/gs/slices/index.js +2 -0
- package/dist/gs/slices/index.js.map +1 -0
- package/dist/gs/slices/slices.d.ts +8 -0
- package/dist/gs/slices/slices.js +20 -0
- package/dist/gs/slices/slices.js.map +1 -0
- package/dist/gs/time/index.d.ts +1 -0
- package/dist/gs/time/time.d.ts +57 -0
- package/dist/gs/time/time.js +103 -10
- package/dist/gs/time/time.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
// Minimal stub for math/bits package
|
|
2
|
+
// This replaces the auto-generated version that has TypeScript syntax errors
|
|
3
|
+
// UintSize is the size of a uint in bits
|
|
4
|
+
export const UintSize = 32; // Assuming 32-bit for JavaScript numbers
|
|
5
|
+
// --- Leading zeros ---
|
|
6
|
+
export function LeadingZeros(x) {
|
|
7
|
+
return Math.clz32(x >>> 0);
|
|
8
|
+
}
|
|
9
|
+
export function LeadingZeros8(x) {
|
|
10
|
+
return Math.clz32((x & 0xFF) << 24);
|
|
11
|
+
}
|
|
12
|
+
export function LeadingZeros16(x) {
|
|
13
|
+
return Math.clz32((x & 0xFFFF) << 16);
|
|
14
|
+
}
|
|
15
|
+
export function LeadingZeros32(x) {
|
|
16
|
+
return Math.clz32(x >>> 0);
|
|
17
|
+
}
|
|
18
|
+
export function LeadingZeros64(x) {
|
|
19
|
+
// For 64-bit, we need to handle it differently
|
|
20
|
+
if (x === 0n)
|
|
21
|
+
return 64;
|
|
22
|
+
let count = 0;
|
|
23
|
+
let mask = 1n << 63n;
|
|
24
|
+
while ((x & mask) === 0n && count < 64) {
|
|
25
|
+
count++;
|
|
26
|
+
mask >>= 1n;
|
|
27
|
+
}
|
|
28
|
+
return count;
|
|
29
|
+
}
|
|
30
|
+
// --- Trailing zeros ---
|
|
31
|
+
export function TrailingZeros(x) {
|
|
32
|
+
if (x === 0)
|
|
33
|
+
return UintSize;
|
|
34
|
+
return TrailingZeros32(x);
|
|
35
|
+
}
|
|
36
|
+
export function TrailingZeros8(x) {
|
|
37
|
+
if (x === 0)
|
|
38
|
+
return 8;
|
|
39
|
+
return Math.min(8, TrailingZeros32(x));
|
|
40
|
+
}
|
|
41
|
+
export function TrailingZeros16(x) {
|
|
42
|
+
if (x === 0)
|
|
43
|
+
return 16;
|
|
44
|
+
return Math.min(16, TrailingZeros32(x));
|
|
45
|
+
}
|
|
46
|
+
export function TrailingZeros32(x) {
|
|
47
|
+
if (x === 0)
|
|
48
|
+
return 32;
|
|
49
|
+
let count = 0;
|
|
50
|
+
while ((x & 1) === 0) {
|
|
51
|
+
count++;
|
|
52
|
+
x >>>= 1;
|
|
53
|
+
}
|
|
54
|
+
return count;
|
|
55
|
+
}
|
|
56
|
+
export function TrailingZeros64(x) {
|
|
57
|
+
if (x === 0n)
|
|
58
|
+
return 64;
|
|
59
|
+
let count = 0;
|
|
60
|
+
while ((x & 1n) === 0n && count < 64) {
|
|
61
|
+
count++;
|
|
62
|
+
x >>= 1n;
|
|
63
|
+
}
|
|
64
|
+
return count;
|
|
65
|
+
}
|
|
66
|
+
// --- Ones count ---
|
|
67
|
+
export function OnesCount(x) {
|
|
68
|
+
return OnesCount32(x);
|
|
69
|
+
}
|
|
70
|
+
export function OnesCount8(x) {
|
|
71
|
+
return OnesCount32(x & 0xFF);
|
|
72
|
+
}
|
|
73
|
+
export function OnesCount16(x) {
|
|
74
|
+
return OnesCount32(x & 0xFFFF);
|
|
75
|
+
}
|
|
76
|
+
export function OnesCount32(x) {
|
|
77
|
+
// Brian Kernighan's algorithm
|
|
78
|
+
let count = 0;
|
|
79
|
+
x = x >>> 0; // Ensure unsigned
|
|
80
|
+
while (x) {
|
|
81
|
+
count++;
|
|
82
|
+
x &= x - 1;
|
|
83
|
+
}
|
|
84
|
+
return count;
|
|
85
|
+
}
|
|
86
|
+
export function OnesCount64(x) {
|
|
87
|
+
let count = 0;
|
|
88
|
+
while (x > 0n) {
|
|
89
|
+
count++;
|
|
90
|
+
x &= x - 1n;
|
|
91
|
+
}
|
|
92
|
+
return count;
|
|
93
|
+
}
|
|
94
|
+
// --- Rotate left ---
|
|
95
|
+
export function RotateLeft(x, k) {
|
|
96
|
+
return RotateLeft32(x, k);
|
|
97
|
+
}
|
|
98
|
+
export function RotateLeft8(x, k) {
|
|
99
|
+
const n = 8;
|
|
100
|
+
k = k % n;
|
|
101
|
+
x = x & 0xFF;
|
|
102
|
+
return ((x << k) | (x >> (n - k))) & 0xFF;
|
|
103
|
+
}
|
|
104
|
+
export function RotateLeft16(x, k) {
|
|
105
|
+
const n = 16;
|
|
106
|
+
k = k % n;
|
|
107
|
+
x = x & 0xFFFF;
|
|
108
|
+
return ((x << k) | (x >> (n - k))) & 0xFFFF;
|
|
109
|
+
}
|
|
110
|
+
export function RotateLeft32(x, k) {
|
|
111
|
+
const n = 32;
|
|
112
|
+
k = k % n;
|
|
113
|
+
x = x >>> 0; // Ensure unsigned
|
|
114
|
+
return ((x << k) | (x >>> (n - k))) >>> 0;
|
|
115
|
+
}
|
|
116
|
+
export function RotateLeft64(x, k) {
|
|
117
|
+
const n = 64;
|
|
118
|
+
k = k % n;
|
|
119
|
+
const mask = (1n << 64n) - 1n;
|
|
120
|
+
x = x & mask;
|
|
121
|
+
return ((x << BigInt(k)) | (x >> BigInt(n - k))) & mask;
|
|
122
|
+
}
|
|
123
|
+
// --- Reverse ---
|
|
124
|
+
export function Reverse(x) {
|
|
125
|
+
return Reverse32(x);
|
|
126
|
+
}
|
|
127
|
+
export function Reverse8(x) {
|
|
128
|
+
x = x & 0xFF;
|
|
129
|
+
x = ((x & 0xF0) >> 4) | ((x & 0x0F) << 4);
|
|
130
|
+
x = ((x & 0xCC) >> 2) | ((x & 0x33) << 2);
|
|
131
|
+
x = ((x & 0xAA) >> 1) | ((x & 0x55) << 1);
|
|
132
|
+
return x;
|
|
133
|
+
}
|
|
134
|
+
export function Reverse16(x) {
|
|
135
|
+
x = x & 0xFFFF;
|
|
136
|
+
x = ((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8);
|
|
137
|
+
x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4);
|
|
138
|
+
x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2);
|
|
139
|
+
x = ((x & 0xAAAA) >> 1) | ((x & 0x5555) << 1);
|
|
140
|
+
return x;
|
|
141
|
+
}
|
|
142
|
+
export function Reverse32(x) {
|
|
143
|
+
x = x >>> 0; // Ensure unsigned
|
|
144
|
+
x = ((x & 0xFFFF0000) >>> 16) | ((x & 0x0000FFFF) << 16);
|
|
145
|
+
x = ((x & 0xFF00FF00) >>> 8) | ((x & 0x00FF00FF) << 8);
|
|
146
|
+
x = ((x & 0xF0F0F0F0) >>> 4) | ((x & 0x0F0F0F0F) << 4);
|
|
147
|
+
x = ((x & 0xCCCCCCCC) >>> 2) | ((x & 0x33333333) << 2);
|
|
148
|
+
x = ((x & 0xAAAAAAAA) >>> 1) | ((x & 0x55555555) << 1);
|
|
149
|
+
return x >>> 0;
|
|
150
|
+
}
|
|
151
|
+
export function Reverse64(x) {
|
|
152
|
+
// Implement 64-bit reverse using similar bit manipulation
|
|
153
|
+
const mask = (1n << 64n) - 1n;
|
|
154
|
+
x = x & mask;
|
|
155
|
+
// Swap 32-bit halves
|
|
156
|
+
x = ((x & 0xffffffff00000000n) >> 32n) | ((x & 0x00000000ffffffffn) << 32n);
|
|
157
|
+
// Swap 16-bit chunks
|
|
158
|
+
x = ((x & 0xffff0000ffff0000n) >> 16n) | ((x & 0x0000ffff0000ffffn) << 16n);
|
|
159
|
+
// Swap 8-bit chunks
|
|
160
|
+
x = ((x & 0xff00ff00ff00ff00n) >> 8n) | ((x & 0x00ff00ff00ff00ffn) << 8n);
|
|
161
|
+
// Swap 4-bit chunks
|
|
162
|
+
x = ((x & 0xf0f0f0f0f0f0f0f0n) >> 4n) | ((x & 0x0f0f0f0f0f0f0f0fn) << 4n);
|
|
163
|
+
// Swap 2-bit chunks
|
|
164
|
+
x = ((x & 0xccccccccccccccccn) >> 2n) | ((x & 0x3333333333333333n) << 2n);
|
|
165
|
+
// Swap 1-bit chunks
|
|
166
|
+
x = ((x & 0xaaaaaaaaaaaaaaaan) >> 1n) | ((x & 0x5555555555555555n) << 1n);
|
|
167
|
+
return x & mask;
|
|
168
|
+
}
|
|
169
|
+
// --- ReverseBytes ---
|
|
170
|
+
export function ReverseBytes(x) {
|
|
171
|
+
return ReverseBytes32(x);
|
|
172
|
+
}
|
|
173
|
+
export function ReverseBytes16(x) {
|
|
174
|
+
return ((x & 0xFF) << 8) | ((x & 0xFF00) >> 8);
|
|
175
|
+
}
|
|
176
|
+
export function ReverseBytes32(x) {
|
|
177
|
+
x = x >>> 0; // Ensure unsigned
|
|
178
|
+
return (((x & 0xFF) << 24) |
|
|
179
|
+
((x & 0xFF00) << 8) |
|
|
180
|
+
((x & 0xFF0000) >> 8) |
|
|
181
|
+
((x & 0xFF000000) >>> 24)) >>> 0;
|
|
182
|
+
}
|
|
183
|
+
export function ReverseBytes64(x) {
|
|
184
|
+
const mask = (1n << 64n) - 1n;
|
|
185
|
+
x = x & mask;
|
|
186
|
+
return (((x & 0xffn) << 56n) |
|
|
187
|
+
((x & 0xff00n) << 40n) |
|
|
188
|
+
((x & 0xff0000n) << 24n) |
|
|
189
|
+
((x & 0xff000000n) << 8n) |
|
|
190
|
+
((x & 0xff00000000n) >> 8n) |
|
|
191
|
+
((x & 0xff0000000000n) >> 24n) |
|
|
192
|
+
((x & 0xff000000000000n) >> 40n) |
|
|
193
|
+
((x & 0xff00000000000000n) >> 56n)) & mask;
|
|
194
|
+
}
|
|
195
|
+
// --- Len ---
|
|
196
|
+
export function Len(x) {
|
|
197
|
+
return Len32(x);
|
|
198
|
+
}
|
|
199
|
+
export function Len8(x) {
|
|
200
|
+
return 8 - LeadingZeros8(x);
|
|
201
|
+
}
|
|
202
|
+
export function Len16(x) {
|
|
203
|
+
return 16 - LeadingZeros16(x);
|
|
204
|
+
}
|
|
205
|
+
export function Len32(x) {
|
|
206
|
+
return 32 - LeadingZeros32(x);
|
|
207
|
+
}
|
|
208
|
+
export function Len64(x) {
|
|
209
|
+
return 64 - LeadingZeros64(x);
|
|
210
|
+
}
|
|
211
|
+
// --- Multiplication functions ---
|
|
212
|
+
export function Mul(x, y) {
|
|
213
|
+
return Mul32(x, y);
|
|
214
|
+
}
|
|
215
|
+
export function Mul32(x, y) {
|
|
216
|
+
// For 32-bit multiplication, we can use JavaScript's number precision
|
|
217
|
+
const result = (x >>> 0) * (y >>> 0);
|
|
218
|
+
const hi = Math.floor(result / 0x100000000) >>> 0;
|
|
219
|
+
const lo = result >>> 0;
|
|
220
|
+
return [hi, lo];
|
|
221
|
+
}
|
|
222
|
+
export function Mul64(x, y) {
|
|
223
|
+
const mask32 = 0xffffffffn;
|
|
224
|
+
// Split into 32-bit parts
|
|
225
|
+
const x0 = x & mask32;
|
|
226
|
+
const x1 = x >> 32n;
|
|
227
|
+
const y0 = y & mask32;
|
|
228
|
+
const y1 = y >> 32n;
|
|
229
|
+
// Multiply parts
|
|
230
|
+
const p00 = x0 * y0;
|
|
231
|
+
const p01 = x0 * y1;
|
|
232
|
+
const p10 = x1 * y0;
|
|
233
|
+
const p11 = x1 * y1;
|
|
234
|
+
// Combine results
|
|
235
|
+
const lo = p00 + ((p01 + p10) << 32n);
|
|
236
|
+
const hi = p11 + ((p01 + p10) >> 32n) + (lo < p00 ? 1n : 0n);
|
|
237
|
+
return [hi, lo];
|
|
238
|
+
}
|
|
239
|
+
// --- Division functions ---
|
|
240
|
+
export function Div(hi, lo, y) {
|
|
241
|
+
return Div32(hi, lo, y);
|
|
242
|
+
}
|
|
243
|
+
export function Div32(hi, lo, y) {
|
|
244
|
+
if (y === 0) {
|
|
245
|
+
throw new Error("division by zero");
|
|
246
|
+
}
|
|
247
|
+
// Combine hi and lo into a 64-bit value using BigInt for precision
|
|
248
|
+
const dividend = (BigInt(hi >>> 0) << 32n) | BigInt(lo >>> 0);
|
|
249
|
+
const divisor = BigInt(y >>> 0);
|
|
250
|
+
const quotient = dividend / divisor;
|
|
251
|
+
const remainder = dividend % divisor;
|
|
252
|
+
return [Number(quotient), Number(remainder)];
|
|
253
|
+
}
|
|
254
|
+
export function Div64(hi, lo, y) {
|
|
255
|
+
if (y === 0n) {
|
|
256
|
+
throw new Error("division by zero");
|
|
257
|
+
}
|
|
258
|
+
// Combine hi and lo into a 128-bit value (simulated)
|
|
259
|
+
// For simplicity, we'll use a basic implementation
|
|
260
|
+
const dividend = (hi << 64n) | lo;
|
|
261
|
+
const quotient = dividend / y;
|
|
262
|
+
const remainder = dividend % y;
|
|
263
|
+
return [quotient, remainder];
|
|
264
|
+
}
|
|
265
|
+
// --- Add and Sub with carry ---
|
|
266
|
+
export function Add(x, y, carry) {
|
|
267
|
+
return Add32(x, y, carry);
|
|
268
|
+
}
|
|
269
|
+
export function Add32(x, y, carry) {
|
|
270
|
+
const sum = (x >>> 0) + (y >>> 0) + (carry >>> 0);
|
|
271
|
+
const result = sum >>> 0;
|
|
272
|
+
const carryOut = sum > 0xFFFFFFFF ? 1 : 0;
|
|
273
|
+
return [result, carryOut];
|
|
274
|
+
}
|
|
275
|
+
export function Add64(x, y, carry) {
|
|
276
|
+
const mask = (1n << 64n) - 1n;
|
|
277
|
+
const sum = (x & mask) + (y & mask) + (carry & mask);
|
|
278
|
+
const result = sum & mask;
|
|
279
|
+
const carryOut = sum > mask ? 1n : 0n;
|
|
280
|
+
return [result, carryOut];
|
|
281
|
+
}
|
|
282
|
+
export function Sub(x, y, borrow) {
|
|
283
|
+
return Sub32(x, y, borrow);
|
|
284
|
+
}
|
|
285
|
+
export function Sub32(x, y, borrow) {
|
|
286
|
+
const diff = (x >>> 0) - (y >>> 0) - (borrow >>> 0);
|
|
287
|
+
const result = diff >>> 0;
|
|
288
|
+
const borrowOut = diff < 0 ? 1 : 0;
|
|
289
|
+
return [result, borrowOut];
|
|
290
|
+
}
|
|
291
|
+
export function Sub64(x, y, borrow) {
|
|
292
|
+
const mask = (1n << 64n) - 1n;
|
|
293
|
+
const diff = (x & mask) - (y & mask) - (borrow & mask);
|
|
294
|
+
const result = diff & mask;
|
|
295
|
+
const borrowOut = diff < 0n ? 1n : 0n;
|
|
296
|
+
return [result, borrowOut];
|
|
297
|
+
}
|
|
298
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../gs/math/bits/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,6EAA6E;AAE7E,yCAAyC;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC,CAAC,yCAAyC;AAErE,wBAAwB;AACxB,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,CAAS;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,CAAS;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,CAAS;IACtC,OAAO,IAAI,CAAC,KAAK,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AC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './runtime.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const GOOS = "js";
|
|
2
|
+
export declare const GOARCH = "wasm";
|
|
3
|
+
export declare function Version(): string;
|
|
4
|
+
export declare function GOMAXPROCS(n: number): number;
|
|
5
|
+
export declare function NumCPU(): number;
|
|
6
|
+
export declare function GC(): void;
|
|
7
|
+
export declare function Gosched(): Promise<void>;
|
|
8
|
+
export declare function NumGoroutine(): number;
|
|
9
|
+
export declare function _incrementGoroutineCount(): void;
|
|
10
|
+
export declare function _decrementGoroutineCount(): void;
|
|
11
|
+
export declare function Caller(skip: number): [number, string, number, boolean];
|
|
12
|
+
export declare function Stack(): Uint8Array;
|
|
13
|
+
export declare class MemStats {
|
|
14
|
+
Alloc: number;
|
|
15
|
+
TotalAlloc: number;
|
|
16
|
+
Sys: number;
|
|
17
|
+
Lookups: number;
|
|
18
|
+
Mallocs: number;
|
|
19
|
+
Frees: number;
|
|
20
|
+
constructor();
|
|
21
|
+
private updateMemoryStats;
|
|
22
|
+
}
|
|
23
|
+
export declare function ReadMemStats(m: MemStats): void;
|
|
24
|
+
export interface Error {
|
|
25
|
+
Error(): string;
|
|
26
|
+
}
|
|
27
|
+
export declare class TypeAssertionError implements Error {
|
|
28
|
+
readonly interfaceType: string;
|
|
29
|
+
readonly concrete: string;
|
|
30
|
+
readonly assertedType: string;
|
|
31
|
+
readonly missingMethod?: string | undefined;
|
|
32
|
+
constructor(interfaceType: string, concrete: string, assertedType: string, missingMethod?: string | undefined);
|
|
33
|
+
Error(): string;
|
|
34
|
+
}
|
|
35
|
+
export declare class PanicError implements Error {
|
|
36
|
+
readonly value: any;
|
|
37
|
+
constructor(value: any);
|
|
38
|
+
Error(): string;
|
|
39
|
+
}
|
|
40
|
+
export declare function SetFinalizer(obj: object, finalizer: ((obj: object) => void) | null): void;
|
|
41
|
+
export declare function KeepAlive(obj: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../gs/runtime/runtime.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC;AACzB,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC;AAE7B,6CAA6C;AAC7C,MAAM,UAAU,OAAO
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../gs/runtime/runtime.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC;AACzB,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC;AAE7B,6CAA6C;AAC7C,MAAM,UAAU,OAAO;IACrB,OAAO,UAAU,CAAC,CAAC,4CAA4C;AACjE,CAAC;AAED,iEAAiE;AACjE,kEAAkE;AAClE,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,kEAAkE;IAClE,6DAA6D;IAC7D,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACV,oDAAoD;QACpD,OAAO,MAAM,EAAE,CAAC;IAClB,CAAC;IACD,uDAAuD;IACvD,qDAAqD;IACrD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,MAAM;IACpB,yEAAyE;IACzE,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,mBAAmB,EAAE,CAAC;QACtE,OAAO,SAAS,CAAC,mBAAmB,CAAC;IACvC,CAAC;IACD,qCAAqC;IACrC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,+DAA+D;AAC/D,qFAAqF;AACrF,MAAM,UAAU,EAAE;IAChB,mDAAmD;IACnD,wEAAwE;IACxE,IAAI,OAAO,UAAU,CAAC,EAAE,KAAK,UAAU,EAAE,CAAC;QACvC,UAAkB,CAAC,EAAE,EAAE,CAAC;IAC3B,CAAC;IACD,6BAA6B;AAC/B,CAAC;AAED,kEAA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Q;QACrB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,iBAAY,GAAZ,YAAY,CAAQ;QACpB,kBAAa,GAAb,aAAa,CAAS;IACrC,CAAC;IAEJ,KAAK;QACH,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,OAAO,yBAAyB,IAAI,CAAC,aAAa,OAAO,IAAI,CAAC,QAAQ,SAAS,IAAI,CAAC,YAAY,aAAa,IAAI,CAAC,aAAa,UAAU,CAAC;QAC5I,CAAC;QACD,OAAO,yBAAyB,IAAI,CAAC,aAAa,OAAO,IAAI,CAAC,QAAQ,SAAS,IAAI,CAAC,YAAY,EAAE,CAAC;IACrG,CAAC;CACF;AAED,gCAAgC;AAChC,MAAM,OAAO,UAAU;IACO;IAA5B,YAA4B,KAAU;QAAV,UAAK,GAAL,KAAK,CAAK;IAAG,CAAC;IAE1C,KAAK;QACH,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACF;AAED,0FAA0F;AAC1F,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,SAAyC;IACjF,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;AAC9F,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,SAAS,CAAC,GAAQ;IAChC,wEAAwE;IACxE,mFAAmF;IACnF,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,oCAAoC;QACpC,KAAK,GAAG,CAAC;IACX,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './slices.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../gs/slices/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as $ from "@goscript/builtin/builtin.js";
|
|
2
|
+
/**
|
|
3
|
+
* All returns an iterator over index-value pairs in the slice.
|
|
4
|
+
* This is equivalent to Go's slices.All function.
|
|
5
|
+
* @param s The slice to iterate over
|
|
6
|
+
* @returns An iterator function that yields index-value pairs
|
|
7
|
+
*/
|
|
8
|
+
export declare function All<T>(s: $.Slice<T>): (yieldFunc: (index: number, value: T) => boolean) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// TypeScript implementation of Go's slices package
|
|
2
|
+
import * as $ from "@goscript/builtin/builtin.js";
|
|
3
|
+
/**
|
|
4
|
+
* All returns an iterator over index-value pairs in the slice.
|
|
5
|
+
* This is equivalent to Go's slices.All function.
|
|
6
|
+
* @param s The slice to iterate over
|
|
7
|
+
* @returns An iterator function that yields index-value pairs
|
|
8
|
+
*/
|
|
9
|
+
export function All(s) {
|
|
10
|
+
return function (_yield) {
|
|
11
|
+
const length = $.len(s);
|
|
12
|
+
for (let i = 0; i < length; i++) {
|
|
13
|
+
const value = s[i]; // Use proper indexing to avoid type issues
|
|
14
|
+
if (!_yield(i, value)) {
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=slices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slices.js","sourceRoot":"","sources":["../../../gs/slices/slices.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,KAAK,CAAC,MAAM,8BAA8B,CAAC;AAElD;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAI,CAAa;IAClC,OAAO,UAAS,MAA4C;QAC1D,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,KAAK,GAAI,CAAS,CAAC,CAAC,CAAM,CAAC,CAAC,2CAA2C;YAC7E,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;gBACtB,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './time.js';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare class Time {
|
|
2
|
+
private _date;
|
|
3
|
+
private _nsec;
|
|
4
|
+
private _monotonic?;
|
|
5
|
+
constructor(date: globalThis.Date, nsec?: number, monotonic?: number);
|
|
6
|
+
clone(): Time;
|
|
7
|
+
Sub(u: Time): Duration;
|
|
8
|
+
Add(d: Duration): Time;
|
|
9
|
+
Equal(u: Time): boolean;
|
|
10
|
+
Before(u: Time): boolean;
|
|
11
|
+
After(u: Time): boolean;
|
|
12
|
+
Round(d: Duration): Time;
|
|
13
|
+
Truncate(d: Duration): Time;
|
|
14
|
+
String(): string;
|
|
15
|
+
}
|
|
16
|
+
export declare class Duration {
|
|
17
|
+
private _nanoseconds;
|
|
18
|
+
constructor(nanoseconds: number);
|
|
19
|
+
lt(other: Duration): boolean;
|
|
20
|
+
static multiply(duration: Duration, multiplier: number): Duration;
|
|
21
|
+
multiply(multiplier: number): Duration;
|
|
22
|
+
valueOf(): number;
|
|
23
|
+
toString(): string;
|
|
24
|
+
}
|
|
25
|
+
export declare function multiplyDuration(duration: Duration, multiplier: number): Duration;
|
|
26
|
+
export declare class Location {
|
|
27
|
+
private _name;
|
|
28
|
+
constructor(name: string);
|
|
29
|
+
get name(): string;
|
|
30
|
+
}
|
|
31
|
+
export declare enum Month {
|
|
32
|
+
January = 1,
|
|
33
|
+
February = 2,
|
|
34
|
+
March = 3,
|
|
35
|
+
April = 4,
|
|
36
|
+
May = 5,
|
|
37
|
+
June = 6,
|
|
38
|
+
July = 7,
|
|
39
|
+
August = 8,
|
|
40
|
+
September = 9,
|
|
41
|
+
October = 10,
|
|
42
|
+
November = 11,
|
|
43
|
+
December = 12
|
|
44
|
+
}
|
|
45
|
+
export declare function Now(): Time;
|
|
46
|
+
export declare function Date(year: number, month: Month, day: number, hour: number, min: number, sec: number, nsec: number, loc: Location): Time;
|
|
47
|
+
export declare const UTC: Location;
|
|
48
|
+
export declare const Nanosecond: Duration;
|
|
49
|
+
export declare const Microsecond: Duration;
|
|
50
|
+
export declare const Millisecond: Duration;
|
|
51
|
+
export declare const Second: Duration;
|
|
52
|
+
export declare const Minute: Duration;
|
|
53
|
+
export declare const Hour: Duration;
|
|
54
|
+
export declare function Since(t: Time): Duration;
|
|
55
|
+
export declare function Until(t: Time): Duration;
|
|
56
|
+
export declare function Sleep(d: Duration): Promise<void>;
|
|
57
|
+
export declare const May = Month.May;
|
package/dist/gs/time/time.js
CHANGED
|
@@ -2,20 +2,80 @@
|
|
|
2
2
|
export class Time {
|
|
3
3
|
_date;
|
|
4
4
|
_nsec; // nanoseconds within the second
|
|
5
|
-
|
|
5
|
+
_monotonic; // high-resolution monotonic timestamp in nanoseconds
|
|
6
|
+
constructor(date, nsec = 0, monotonic) {
|
|
6
7
|
this._date = new globalThis.Date(date.getTime());
|
|
7
8
|
this._nsec = nsec;
|
|
9
|
+
this._monotonic = monotonic;
|
|
8
10
|
}
|
|
9
11
|
// clone returns a copy of this Time instance
|
|
10
12
|
clone() {
|
|
11
|
-
return new Time(this._date, this._nsec);
|
|
13
|
+
return new Time(this._date, this._nsec, this._monotonic);
|
|
12
14
|
}
|
|
13
15
|
// Sub returns the duration t-u
|
|
16
|
+
// If both times have monotonic readings, use them for accurate duration calculation
|
|
14
17
|
Sub(u) {
|
|
18
|
+
// If both times have monotonic readings, use them for more accurate duration calculation
|
|
19
|
+
if (this._monotonic !== undefined && u._monotonic !== undefined) {
|
|
20
|
+
const diffNs = this._monotonic - u._monotonic;
|
|
21
|
+
return new Duration(diffNs);
|
|
22
|
+
}
|
|
23
|
+
// Fallback to Date-based calculation
|
|
15
24
|
const diffMs = this._date.getTime() - u._date.getTime();
|
|
16
25
|
const diffNs = (this._nsec - u._nsec);
|
|
17
26
|
return new Duration(diffMs * 1000000 + diffNs); // Convert ms to ns and add ns difference
|
|
18
27
|
}
|
|
28
|
+
// Add adds the duration d to t, returning the sum
|
|
29
|
+
// Preserves monotonic reading if present
|
|
30
|
+
Add(d) {
|
|
31
|
+
const durationNs = d.valueOf();
|
|
32
|
+
const newDate = new globalThis.Date(this._date.getTime() + Math.floor(durationNs / 1000000));
|
|
33
|
+
const newNsec = this._nsec + (durationNs % 1000000);
|
|
34
|
+
const newMonotonic = this._monotonic !== undefined ? this._monotonic + durationNs : undefined;
|
|
35
|
+
return new Time(newDate, newNsec, newMonotonic);
|
|
36
|
+
}
|
|
37
|
+
// Equal reports whether t and u represent the same time instant
|
|
38
|
+
// Uses monotonic clock if both times have it
|
|
39
|
+
Equal(u) {
|
|
40
|
+
if (this._monotonic !== undefined && u._monotonic !== undefined) {
|
|
41
|
+
return this._monotonic === u._monotonic;
|
|
42
|
+
}
|
|
43
|
+
return this._date.getTime() === u._date.getTime() && this._nsec === u._nsec;
|
|
44
|
+
}
|
|
45
|
+
// Before reports whether the time instant t is before u
|
|
46
|
+
// Uses monotonic clock if both times have it
|
|
47
|
+
Before(u) {
|
|
48
|
+
if (this._monotonic !== undefined && u._monotonic !== undefined) {
|
|
49
|
+
return this._monotonic < u._monotonic;
|
|
50
|
+
}
|
|
51
|
+
const thisMs = this._date.getTime();
|
|
52
|
+
const uMs = u._date.getTime();
|
|
53
|
+
return thisMs < uMs || (thisMs === uMs && this._nsec < u._nsec);
|
|
54
|
+
}
|
|
55
|
+
// After reports whether the time instant t is after u
|
|
56
|
+
// Uses monotonic clock if both times have it
|
|
57
|
+
After(u) {
|
|
58
|
+
if (this._monotonic !== undefined && u._monotonic !== undefined) {
|
|
59
|
+
return this._monotonic > u._monotonic;
|
|
60
|
+
}
|
|
61
|
+
const thisMs = this._date.getTime();
|
|
62
|
+
const uMs = u._date.getTime();
|
|
63
|
+
return thisMs > uMs || (thisMs === uMs && this._nsec > u._nsec);
|
|
64
|
+
}
|
|
65
|
+
// Round returns the result of rounding t to the nearest multiple of d
|
|
66
|
+
// Strips monotonic reading as per Go specification
|
|
67
|
+
Round(d) {
|
|
68
|
+
// Implementation would round to nearest duration
|
|
69
|
+
// For now, simplified version that strips monotonic reading
|
|
70
|
+
return new Time(this._date, this._nsec);
|
|
71
|
+
}
|
|
72
|
+
// Truncate returns the result of rounding t down to a multiple of d
|
|
73
|
+
// Strips monotonic reading as per Go specification
|
|
74
|
+
Truncate(d) {
|
|
75
|
+
// Implementation would truncate to duration
|
|
76
|
+
// For now, simplified version that strips monotonic reading
|
|
77
|
+
return new Time(this._date, this._nsec);
|
|
78
|
+
}
|
|
19
79
|
// String returns the time formatted as a string
|
|
20
80
|
String() {
|
|
21
81
|
// Format as "YYYY-MM-DD HH:MM:SS +0000 UTC" to match Go's format
|
|
@@ -25,7 +85,12 @@ export class Time {
|
|
|
25
85
|
const hour = String(this._date.getUTCHours()).padStart(2, '0');
|
|
26
86
|
const minute = String(this._date.getUTCMinutes()).padStart(2, '0');
|
|
27
87
|
const second = String(this._date.getUTCSeconds()).padStart(2, '0');
|
|
28
|
-
|
|
88
|
+
let result = `${year}-${month}-${day} ${hour}:${minute}:${second} +0000 UTC`;
|
|
89
|
+
// Include monotonic reading in debug output as per Go specification
|
|
90
|
+
if (this._monotonic !== undefined) {
|
|
91
|
+
result += ` m=${this._monotonic}`;
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
29
94
|
}
|
|
30
95
|
}
|
|
31
96
|
// Duration represents a span of time
|
|
@@ -69,9 +134,8 @@ export class Location {
|
|
|
69
134
|
return this._name;
|
|
70
135
|
}
|
|
71
136
|
}
|
|
72
|
-
export { Month };
|
|
73
137
|
// Month represents a month of the year
|
|
74
|
-
var Month;
|
|
138
|
+
export var Month;
|
|
75
139
|
(function (Month) {
|
|
76
140
|
Month[Month["January"] = 1] = "January";
|
|
77
141
|
Month[Month["February"] = 2] = "February";
|
|
@@ -86,13 +150,22 @@ var Month;
|
|
|
86
150
|
Month[Month["November"] = 11] = "November";
|
|
87
151
|
Month[Month["December"] = 12] = "December";
|
|
88
152
|
})(Month || (Month = {}));
|
|
89
|
-
// Now returns the current local time
|
|
153
|
+
// Now returns the current local time with monotonic clock reading
|
|
90
154
|
export function Now() {
|
|
91
|
-
|
|
155
|
+
const date = new globalThis.Date();
|
|
156
|
+
let monotonic;
|
|
157
|
+
// Use performance.now() for high-resolution monotonic timing if available
|
|
158
|
+
if (typeof performance !== 'undefined' && performance.now) {
|
|
159
|
+
// performance.now() returns milliseconds with sub-millisecond precision
|
|
160
|
+
// Convert to nanoseconds for consistency with Go's time package
|
|
161
|
+
monotonic = performance.now() * 1000000;
|
|
162
|
+
}
|
|
163
|
+
return new Time(date, 0, monotonic);
|
|
92
164
|
}
|
|
93
165
|
// Date returns the Time corresponding to
|
|
94
166
|
// yyyy-mm-dd hh:mm:ss + nsec nanoseconds
|
|
95
167
|
// in the appropriate zone for that time in the given location
|
|
168
|
+
// Does not include monotonic reading as per Go specification
|
|
96
169
|
export function Date(year, month, day, hour, min, sec, nsec, loc) {
|
|
97
170
|
let date;
|
|
98
171
|
if (loc.name === "UTC") {
|
|
@@ -104,12 +177,32 @@ export function Date(year, month, day, hour, min, sec, nsec, loc) {
|
|
|
104
177
|
// For local time or other timezones, use regular Date constructor
|
|
105
178
|
date = new globalThis.Date(year, month - 1, day, hour, min, sec, Math.floor(nsec / 1000000));
|
|
106
179
|
}
|
|
107
|
-
return new Time(date, nsec % 1000000);
|
|
180
|
+
return new Time(date, nsec % 1000000); // No monotonic reading
|
|
108
181
|
}
|
|
109
182
|
// Common locations
|
|
110
183
|
export const UTC = new Location("UTC");
|
|
111
|
-
// Common durations
|
|
112
|
-
export const
|
|
184
|
+
// Common durations (matching Go's time package constants)
|
|
185
|
+
export const Nanosecond = new Duration(1);
|
|
186
|
+
export const Microsecond = new Duration(1000);
|
|
187
|
+
export const Millisecond = new Duration(1000000);
|
|
188
|
+
export const Second = new Duration(1000000000);
|
|
189
|
+
export const Minute = new Duration(60000000000);
|
|
190
|
+
export const Hour = new Duration(3600000000000);
|
|
191
|
+
// Since returns the time elapsed since t
|
|
192
|
+
// Uses monotonic clock if available for accurate measurement
|
|
193
|
+
export function Since(t) {
|
|
194
|
+
return Now().Sub(t);
|
|
195
|
+
}
|
|
196
|
+
// Until returns the duration until t
|
|
197
|
+
// Uses monotonic clock if available for accurate measurement
|
|
198
|
+
export function Until(t) {
|
|
199
|
+
return t.Sub(Now());
|
|
200
|
+
}
|
|
201
|
+
// Sleep pauses the current execution for at least the duration d
|
|
202
|
+
export async function Sleep(d) {
|
|
203
|
+
const ms = d.valueOf() / 1000000; // Convert nanoseconds to milliseconds
|
|
204
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
205
|
+
}
|
|
113
206
|
// Export month constants
|
|
114
207
|
export const May = Month.May;
|
|
115
208
|
//# sourceMappingURL=time.js.map
|