goscript 0.0.48 → 0.0.50
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/cmd/goscript/deps.go +1 -4
- package/compiler/analysis.go +1120 -513
- package/compiler/analysis_test.go +113 -4
- package/compiler/compiler.go +88 -124
- package/compiler/decl.go +22 -0
- package/compiler/expr-call-async.go +46 -52
- package/compiler/expr-call-type-conversion.go +144 -59
- package/compiler/expr-call.go +235 -12
- package/compiler/expr.go +5 -82
- package/compiler/gs_dependencies_test.go +60 -1
- package/compiler/spec-value.go +73 -51
- package/compiler/spec.go +337 -151
- package/compiler/stmt-assign.go +7 -4
- package/compiler/stmt.go +250 -81
- package/compiler/type.go +13 -0
- package/dist/gs/builtin/builtin.d.ts +1 -5
- package/dist/gs/builtin/builtin.js +1 -34
- package/dist/gs/builtin/builtin.js.map +1 -1
- package/dist/gs/builtin/slice.js.map +1 -1
- package/dist/gs/context/context.d.ts +16 -18
- package/dist/gs/context/context.js +23 -13
- package/dist/gs/context/context.js.map +1 -1
- package/dist/gs/fmt/fmt.js +22 -4
- package/dist/gs/fmt/fmt.js.map +1 -1
- package/dist/gs/io/fs/fs.d.ts +6 -12
- package/dist/gs/io/fs/fs.js +52 -67
- package/dist/gs/io/fs/fs.js.map +1 -1
- package/dist/gs/os/index.d.ts +2 -1
- package/dist/gs/os/index.js +1 -1
- package/dist/gs/os/index.js.map +1 -1
- package/dist/gs/os/types_js.gs.d.ts +7 -1
- package/dist/gs/os/types_js.gs.js +16 -1
- package/dist/gs/os/types_js.gs.js.map +1 -1
- package/dist/gs/os/types_unix.gs.js +2 -2
- package/dist/gs/os/types_unix.gs.js.map +1 -1
- package/dist/gs/reflect/index.d.ts +3 -3
- package/dist/gs/reflect/index.js +2 -2
- package/dist/gs/reflect/index.js.map +1 -1
- package/dist/gs/reflect/map.js +2 -2
- package/dist/gs/reflect/map.js.map +1 -1
- package/dist/gs/reflect/type.d.ts +8 -9
- package/dist/gs/reflect/type.js +98 -103
- package/dist/gs/reflect/type.js.map +1 -1
- package/dist/gs/reflect/types.d.ts +1 -10
- package/dist/gs/reflect/types.js +3 -26
- package/dist/gs/reflect/types.js.map +1 -1
- package/dist/gs/reflect/value.js +23 -23
- package/dist/gs/reflect/value.js.map +1 -1
- package/dist/gs/reflect/visiblefields.js +3 -3
- package/dist/gs/reflect/visiblefields.js.map +1 -1
- package/dist/gs/time/time.d.ts +13 -23
- package/dist/gs/time/time.js +57 -75
- package/dist/gs/time/time.js.map +1 -1
- package/gs/builtin/builtin.ts +3 -47
- package/gs/builtin/slice.ts +1 -1
- package/gs/bytes/meta.json +10 -0
- package/gs/context/context.ts +63 -45
- package/gs/fmt/fmt.ts +22 -4
- package/gs/fmt/meta.json +5 -0
- package/gs/internal/meta.json +5 -0
- package/gs/io/fs/fs.ts +58 -73
- package/gs/io/meta.json +9 -0
- package/gs/maps/meta.json +6 -0
- package/gs/math/meta.json +5 -0
- package/gs/os/index.ts +8 -1
- package/gs/os/meta.json +15 -0
- package/gs/os/types_js.gs.ts +22 -1
- package/gs/os/types_unix.gs.ts +2 -2
- package/gs/path/meta.json +6 -0
- package/gs/reflect/function-types.test.ts +10 -10
- package/gs/reflect/index.ts +6 -6
- package/gs/reflect/map.ts +2 -2
- package/gs/reflect/meta.json +5 -0
- package/gs/reflect/type.ts +105 -105
- package/gs/reflect/types.ts +2 -28
- package/gs/reflect/value.ts +23 -23
- package/gs/reflect/visiblefields.ts +3 -3
- package/gs/strconv/meta.json +5 -0
- package/gs/strings/meta.json +9 -0
- package/gs/sync/meta.json +19 -0
- package/gs/time/time.ts +65 -84
- package/package.json +2 -2
- package/dist/gs/builtin/io.d.ts +0 -16
- package/dist/gs/builtin/io.js +0 -15
- package/dist/gs/builtin/io.js.map +0 -1
- package/dist/gs/internal/testlog/index.d.ts +0 -1
- package/dist/gs/internal/testlog/index.js +0 -5
- package/dist/gs/internal/testlog/index.js.map +0 -1
- package/dist/gs/maps/iter.gs.d.ts +0 -7
- package/dist/gs/maps/iter.gs.js +0 -65
- package/dist/gs/maps/iter.gs.js.map +0 -1
- package/dist/gs/maps/maps.gs.d.ts +0 -7
- package/dist/gs/maps/maps.gs.js +0 -79
- package/dist/gs/maps/maps.gs.js.map +0 -1
- package/dist/gs/reflect/abi.d.ts +0 -59
- package/dist/gs/reflect/abi.gs.d.ts +0 -59
- package/dist/gs/reflect/abi.gs.js +0 -79
- package/dist/gs/reflect/abi.gs.js.map +0 -1
- package/dist/gs/reflect/abi.js +0 -79
- package/dist/gs/reflect/abi.js.map +0 -1
- package/dist/gs/reflect/badlinkname.d.ts +0 -52
- package/dist/gs/reflect/badlinkname.gs.d.ts +0 -52
- package/dist/gs/reflect/badlinkname.gs.js +0 -72
- package/dist/gs/reflect/badlinkname.gs.js.map +0 -1
- package/dist/gs/reflect/badlinkname.js +0 -72
- package/dist/gs/reflect/badlinkname.js.map +0 -1
- package/dist/gs/reflect/deepequal.gs.d.ts +0 -25
- package/dist/gs/reflect/deepequal.gs.js +0 -308
- package/dist/gs/reflect/deepequal.gs.js.map +0 -1
- package/dist/gs/reflect/float32reg_generic.gs.d.ts +0 -2
- package/dist/gs/reflect/float32reg_generic.gs.js +0 -10
- package/dist/gs/reflect/float32reg_generic.gs.js.map +0 -1
- package/dist/gs/reflect/index.gs.d.ts +0 -1
- package/dist/gs/reflect/index.gs.js +0 -3
- package/dist/gs/reflect/index.gs.js.map +0 -1
- package/dist/gs/reflect/iter.gs.d.ts +0 -3
- package/dist/gs/reflect/iter.gs.js +0 -24
- package/dist/gs/reflect/iter.gs.js.map +0 -1
- package/dist/gs/reflect/makefunc.gs.d.ts +0 -34
- package/dist/gs/reflect/makefunc.gs.js +0 -288
- package/dist/gs/reflect/makefunc.gs.js.map +0 -1
- package/dist/gs/reflect/map_swiss.gs.d.ts +0 -14
- package/dist/gs/reflect/map_swiss.gs.js +0 -70
- package/dist/gs/reflect/map_swiss.gs.js.map +0 -1
- package/dist/gs/reflect/reflect.gs.d.ts +0 -132
- package/dist/gs/reflect/reflect.gs.js +0 -437
- package/dist/gs/reflect/reflect.gs.js.map +0 -1
- package/dist/gs/reflect/swapper.gs.d.ts +0 -1
- package/dist/gs/reflect/swapper.gs.js +0 -32
- package/dist/gs/reflect/swapper.gs.js.map +0 -1
- package/dist/gs/reflect/type.gs.d.ts +0 -4
- package/dist/gs/reflect/type.gs.js +0 -21
- package/dist/gs/reflect/type.gs.js.map +0 -1
- package/dist/gs/reflect/value.gs.d.ts +0 -4
- package/dist/gs/reflect/value.gs.js +0 -12
- package/dist/gs/reflect/value.gs.js.map +0 -1
- package/dist/gs/reflect/visiblefields.gs.d.ts +0 -3
- package/dist/gs/reflect/visiblefields.gs.js +0 -123
- package/dist/gs/reflect/visiblefields.gs.js.map +0 -1
- package/dist/gs/stringslite/index.d.ts +0 -1
- package/dist/gs/stringslite/index.js +0 -2
- package/dist/gs/stringslite/index.js.map +0 -1
- package/dist/gs/stringslite/strings.d.ts +0 -11
- package/dist/gs/stringslite/strings.js +0 -67
- package/dist/gs/stringslite/strings.js.map +0 -1
- package/gs/bytes/metadata.go +0 -12
- package/gs/fmt/metadata.go +0 -7
- package/gs/internal/metadata.go +0 -7
- package/gs/io/io.go +0 -75
- package/gs/io/metadata.go +0 -11
- package/gs/maps/metadata.go +0 -8
- package/gs/math/metadata.go +0 -7
- package/gs/os/metadata.go +0 -17
- package/gs/path/metadata.go +0 -8
- package/gs/reflect/metadata.go +0 -7
- package/gs/strconv/metadata.go +0 -7
- package/gs/strings/metadata.go +0 -11
- package/gs/sync/metadata.go +0 -7
- package/gs/sync/sync.go +0 -64
package/gs/time/time.ts
CHANGED
|
@@ -5,21 +5,32 @@ export class Time {
|
|
|
5
5
|
private _monotonic?: number // high-resolution monotonic timestamp in nanoseconds
|
|
6
6
|
private _location: Location // timezone location
|
|
7
7
|
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(_props?: {}) {
|
|
9
|
+
// Default constructor creates a zero time (Unix epoch in UTC)
|
|
10
|
+
this._date = new globalThis.Date(0)
|
|
11
|
+
this._nsec = 0
|
|
12
|
+
this._monotonic = undefined
|
|
13
|
+
this._location = UTC
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// create is a static factory method that creates a Time instance with specific parameters
|
|
17
|
+
public static create(
|
|
9
18
|
date: globalThis.Date,
|
|
10
19
|
nsec: number = 0,
|
|
11
20
|
monotonic?: number,
|
|
12
21
|
location?: Location,
|
|
13
|
-
) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
): Time {
|
|
23
|
+
const time = new Time()
|
|
24
|
+
time._date = new globalThis.Date(date.getTime())
|
|
25
|
+
time._nsec = nsec
|
|
26
|
+
time._monotonic = monotonic
|
|
27
|
+
time._location = location || UTC
|
|
28
|
+
return time
|
|
18
29
|
}
|
|
19
30
|
|
|
20
31
|
// clone returns a copy of this Time instance
|
|
21
32
|
public clone(): Time {
|
|
22
|
-
return
|
|
33
|
+
return Time.create(this._date, this._nsec, this._monotonic, this._location)
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
// Unix returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC
|
|
@@ -45,13 +56,13 @@ export class Time {
|
|
|
45
56
|
}
|
|
46
57
|
|
|
47
58
|
// Weekday returns the day of the week specified by t
|
|
48
|
-
public Weekday():
|
|
59
|
+
public Weekday(): Weekday {
|
|
49
60
|
if (this._location.offsetSeconds !== undefined) {
|
|
50
61
|
const offsetMs = this._location.offsetSeconds * 1000
|
|
51
62
|
const adjustedTime = new globalThis.Date(this._date.getTime() + offsetMs)
|
|
52
|
-
return
|
|
63
|
+
return adjustedTime.getUTCDay() as Weekday
|
|
53
64
|
}
|
|
54
|
-
return
|
|
65
|
+
return this._date.getDay() as Weekday
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
// Day returns the day of the month specified by t
|
|
@@ -473,26 +484,26 @@ export class Time {
|
|
|
473
484
|
// If both times have monotonic readings, use them for more accurate duration calculation
|
|
474
485
|
if (this._monotonic !== undefined && u._monotonic !== undefined) {
|
|
475
486
|
const diffNs = this._monotonic - u._monotonic
|
|
476
|
-
return
|
|
487
|
+
return diffNs
|
|
477
488
|
}
|
|
478
489
|
|
|
479
490
|
// Fallback to Date-based calculation
|
|
480
491
|
const diffMs = this._date.getTime() - u._date.getTime()
|
|
481
492
|
const diffNs = this._nsec - u._nsec
|
|
482
|
-
return
|
|
493
|
+
return diffMs * 1000000 + diffNs
|
|
483
494
|
}
|
|
484
495
|
|
|
485
496
|
// Add adds the duration d to t, returning the sum
|
|
486
497
|
// Preserves monotonic reading if present
|
|
487
498
|
public Add(d: Duration): Time {
|
|
488
|
-
const durationNs = d
|
|
499
|
+
const durationNs = d
|
|
489
500
|
const newDate = new globalThis.Date(
|
|
490
501
|
this._date.getTime() + Math.floor(durationNs / 1000000),
|
|
491
502
|
)
|
|
492
503
|
const newNsec = this._nsec + (durationNs % 1000000)
|
|
493
504
|
const newMonotonic =
|
|
494
505
|
this._monotonic !== undefined ? this._monotonic + durationNs : undefined
|
|
495
|
-
return
|
|
506
|
+
return Time.create(newDate, newNsec, newMonotonic, this._location)
|
|
496
507
|
}
|
|
497
508
|
|
|
498
509
|
// Equal reports whether t and u represent the same time instant
|
|
@@ -531,7 +542,7 @@ export class Time {
|
|
|
531
542
|
public Round(_d: Duration): Time {
|
|
532
543
|
// Implementation would round to nearest duration
|
|
533
544
|
// For now, simplified version that strips monotonic reading
|
|
534
|
-
return
|
|
545
|
+
return Time.create(this._date, this._nsec, undefined, this._location)
|
|
535
546
|
}
|
|
536
547
|
|
|
537
548
|
// Truncate returns the result of rounding t down to a multiple of d
|
|
@@ -539,7 +550,7 @@ export class Time {
|
|
|
539
550
|
public Truncate(_d: Duration): Time {
|
|
540
551
|
// Implementation would truncate to duration
|
|
541
552
|
// For now, simplified version that strips monotonic reading
|
|
542
|
-
return
|
|
553
|
+
return Time.create(this._date, this._nsec, undefined, this._location)
|
|
543
554
|
}
|
|
544
555
|
|
|
545
556
|
// String returns the time formatted as a string
|
|
@@ -563,38 +574,20 @@ export class Time {
|
|
|
563
574
|
}
|
|
564
575
|
}
|
|
565
576
|
|
|
566
|
-
// Duration represents a span of time
|
|
567
|
-
export
|
|
568
|
-
private _nanoseconds: number
|
|
569
|
-
|
|
570
|
-
constructor(nanoseconds: number) {
|
|
571
|
-
this._nanoseconds = nanoseconds
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
// Compare this duration with another
|
|
575
|
-
public lt(other: Duration): boolean {
|
|
576
|
-
return this._nanoseconds < other._nanoseconds
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
// Multiply duration by a number (for expressions like Hour * 24)
|
|
580
|
-
public static multiply(duration: Duration, multiplier: number): Duration {
|
|
581
|
-
return new Duration(duration._nanoseconds * multiplier)
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
// Add support for * operator
|
|
585
|
-
public multiply(multiplier: number): Duration {
|
|
586
|
-
return Duration.multiply(this, multiplier)
|
|
587
|
-
}
|
|
577
|
+
// Duration represents a span of time (nanoseconds)
|
|
578
|
+
export type Duration = number
|
|
588
579
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
580
|
+
// Duration comparison function
|
|
581
|
+
export function Duration_lt(receiver: Duration, other: Duration): boolean {
|
|
582
|
+
return receiver < other
|
|
583
|
+
}
|
|
593
584
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
585
|
+
// Duration multiplication function
|
|
586
|
+
export function Duration_multiply(
|
|
587
|
+
receiver: Duration,
|
|
588
|
+
multiplier: number,
|
|
589
|
+
): Duration {
|
|
590
|
+
return receiver * multiplier
|
|
598
591
|
}
|
|
599
592
|
|
|
600
593
|
// Override multiplication operator for Duration * number
|
|
@@ -602,7 +595,7 @@ export function multiplyDuration(
|
|
|
602
595
|
duration: Duration,
|
|
603
596
|
multiplier: number,
|
|
604
597
|
): Duration {
|
|
605
|
-
return
|
|
598
|
+
return duration * multiplier
|
|
606
599
|
}
|
|
607
600
|
|
|
608
601
|
// Location represents a time zone
|
|
@@ -670,21 +663,9 @@ export function WeekdayString(w: Weekday): string {
|
|
|
670
663
|
return names[w] || 'Unknown'
|
|
671
664
|
}
|
|
672
665
|
|
|
673
|
-
//
|
|
674
|
-
export
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
constructor(value: Weekday) {
|
|
678
|
-
this._value = value
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
public valueOf(): number {
|
|
682
|
-
return this._value
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
public String(): string {
|
|
686
|
-
return WeekdayString(this._value)
|
|
687
|
-
}
|
|
666
|
+
// Weekday_String returns the string representation of a Weekday (wrapper function naming)
|
|
667
|
+
export function Weekday_String(w: Weekday): string {
|
|
668
|
+
return WeekdayString(w)
|
|
688
669
|
}
|
|
689
670
|
|
|
690
671
|
// ParseError describes a problem parsing a time string
|
|
@@ -721,7 +702,7 @@ export class Timer {
|
|
|
721
702
|
constructor(duration: Duration, callback?: () => void) {
|
|
722
703
|
this._duration = duration
|
|
723
704
|
this._callback = callback
|
|
724
|
-
const ms = duration
|
|
705
|
+
const ms = duration / 1000000 // Convert nanoseconds to milliseconds
|
|
725
706
|
|
|
726
707
|
if (callback) {
|
|
727
708
|
this._timeout = setTimeout(callback, ms)
|
|
@@ -743,7 +724,7 @@ export class Timer {
|
|
|
743
724
|
// Reset changes the timer to expire after duration d
|
|
744
725
|
public Reset(d: Duration): boolean {
|
|
745
726
|
this.Stop()
|
|
746
|
-
const ms = d
|
|
727
|
+
const ms = d / 1000000
|
|
747
728
|
if (this._callback) {
|
|
748
729
|
this._timeout = setTimeout(this._callback, ms)
|
|
749
730
|
} else {
|
|
@@ -761,7 +742,7 @@ export class Ticker {
|
|
|
761
742
|
|
|
762
743
|
constructor(duration: Duration) {
|
|
763
744
|
this._duration = duration
|
|
764
|
-
const ms = duration
|
|
745
|
+
const ms = duration / 1000000 // Convert nanoseconds to milliseconds
|
|
765
746
|
this._interval = setInterval(() => {}, ms)
|
|
766
747
|
}
|
|
767
748
|
|
|
@@ -780,13 +761,13 @@ export class Ticker {
|
|
|
780
761
|
this.Stop()
|
|
781
762
|
this._stopped = false
|
|
782
763
|
this._duration = d
|
|
783
|
-
const ms = d
|
|
764
|
+
const ms = d / 1000000
|
|
784
765
|
this._interval = setInterval(() => {}, ms)
|
|
785
766
|
}
|
|
786
767
|
|
|
787
768
|
// Channel returns an async iterator that yields time values
|
|
788
769
|
public async *Channel(): AsyncIterableIterator<Time> {
|
|
789
|
-
const ms = this._duration
|
|
770
|
+
const ms = this._duration / 1000000
|
|
790
771
|
while (!this._stopped) {
|
|
791
772
|
await new Promise((resolve) => setTimeout(resolve, ms))
|
|
792
773
|
if (!this._stopped) {
|
|
@@ -808,7 +789,7 @@ export function Now(): Time {
|
|
|
808
789
|
monotonic = performance.now() * 1000000
|
|
809
790
|
}
|
|
810
791
|
|
|
811
|
-
return
|
|
792
|
+
return Time.create(date, 0, monotonic)
|
|
812
793
|
}
|
|
813
794
|
|
|
814
795
|
// Date returns the Time corresponding to
|
|
@@ -853,7 +834,7 @@ export function Date(
|
|
|
853
834
|
Math.floor(nsec / 1000000),
|
|
854
835
|
)
|
|
855
836
|
}
|
|
856
|
-
return
|
|
837
|
+
return Time.create(date, nsec % 1000000000, undefined, loc) // No monotonic reading
|
|
857
838
|
}
|
|
858
839
|
|
|
859
840
|
// Common locations
|
|
@@ -865,12 +846,12 @@ export function FixedZone(name: string, offset: number): Location {
|
|
|
865
846
|
}
|
|
866
847
|
|
|
867
848
|
// Common durations (matching Go's time package constants)
|
|
868
|
-
export const Nanosecond =
|
|
869
|
-
export const Microsecond =
|
|
870
|
-
export const Millisecond =
|
|
871
|
-
export const Second =
|
|
872
|
-
export const Minute =
|
|
873
|
-
export const Hour =
|
|
849
|
+
export const Nanosecond = 1
|
|
850
|
+
export const Microsecond = 1000
|
|
851
|
+
export const Millisecond = 1000000
|
|
852
|
+
export const Second = 1000000000
|
|
853
|
+
export const Minute = 60000000000
|
|
854
|
+
export const Hour = 3600000000000
|
|
874
855
|
|
|
875
856
|
// Since returns the time elapsed since t
|
|
876
857
|
// Uses monotonic clock if available for accurate measurement
|
|
@@ -886,7 +867,7 @@ export function Until(t: Time): Duration {
|
|
|
886
867
|
|
|
887
868
|
// Sleep pauses the current execution for at least the duration d
|
|
888
869
|
export async function Sleep(d: Duration): Promise<void> {
|
|
889
|
-
const ms = d
|
|
870
|
+
const ms = d / 1000000 // Convert nanoseconds to milliseconds
|
|
890
871
|
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
891
872
|
}
|
|
892
873
|
|
|
@@ -904,13 +885,13 @@ export const Kitchen = '3:04PM'
|
|
|
904
885
|
export function Unix(sec: number, nsec: number = 0): Time {
|
|
905
886
|
const ms = sec * 1000 + Math.floor(nsec / 1000000)
|
|
906
887
|
const remainingNsec = nsec % 1000000
|
|
907
|
-
return
|
|
888
|
+
return Time.create(new globalThis.Date(ms), remainingNsec, undefined, UTC)
|
|
908
889
|
}
|
|
909
890
|
|
|
910
891
|
// UnixMilli returns the local Time corresponding to the given Unix time,
|
|
911
892
|
// msec milliseconds since January 1, 1970 UTC
|
|
912
893
|
export function UnixMilli(msec: number): Time {
|
|
913
|
-
return
|
|
894
|
+
return Time.create(new globalThis.Date(msec), 0, undefined, UTC)
|
|
914
895
|
}
|
|
915
896
|
|
|
916
897
|
// UnixMicro returns the local Time corresponding to the given Unix time,
|
|
@@ -918,7 +899,7 @@ export function UnixMilli(msec: number): Time {
|
|
|
918
899
|
export function UnixMicro(usec: number): Time {
|
|
919
900
|
const ms = Math.floor(usec / 1000)
|
|
920
901
|
const nsec = (usec % 1000) * 1000
|
|
921
|
-
return
|
|
902
|
+
return Time.create(new globalThis.Date(ms), nsec, undefined, UTC)
|
|
922
903
|
}
|
|
923
904
|
|
|
924
905
|
// UnixNano returns the local Time corresponding to the given Unix time,
|
|
@@ -926,7 +907,7 @@ export function UnixMicro(usec: number): Time {
|
|
|
926
907
|
export function UnixNano(nsec: number): Time {
|
|
927
908
|
const ms = Math.floor(nsec / 1000000)
|
|
928
909
|
const remainingNsec = nsec % 1000000
|
|
929
|
-
return
|
|
910
|
+
return Time.create(new globalThis.Date(ms), remainingNsec, undefined, UTC)
|
|
930
911
|
}
|
|
931
912
|
|
|
932
913
|
// ParseDuration parses a duration string
|
|
@@ -969,7 +950,7 @@ export function ParseDuration(s: string): Duration {
|
|
|
969
950
|
throw new Error(`time: unknown unit "${unit}" in duration "${s}"`)
|
|
970
951
|
}
|
|
971
952
|
|
|
972
|
-
return
|
|
953
|
+
return nanoseconds
|
|
973
954
|
}
|
|
974
955
|
|
|
975
956
|
// Parse parses a formatted string and returns the time value it represents
|
|
@@ -998,7 +979,7 @@ export function ParseInLocation(
|
|
|
998
979
|
`parsing time "${value}" as "${layout}": cannot parse`,
|
|
999
980
|
)
|
|
1000
981
|
}
|
|
1001
|
-
return
|
|
982
|
+
return Time.create(date, 0, undefined, loc)
|
|
1002
983
|
}
|
|
1003
984
|
|
|
1004
985
|
if (layout === DateTime || layout === '2006-01-02 15:04:05') {
|
|
@@ -1012,7 +993,7 @@ export function ParseInLocation(
|
|
|
1012
993
|
`parsing time "${value}" as "${layout}": cannot parse`,
|
|
1013
994
|
)
|
|
1014
995
|
}
|
|
1015
|
-
return
|
|
996
|
+
return Time.create(date, 0, undefined, loc)
|
|
1016
997
|
}
|
|
1017
998
|
|
|
1018
999
|
// Fallback to standard Date parsing
|
|
@@ -1026,7 +1007,7 @@ export function ParseInLocation(
|
|
|
1026
1007
|
`parsing time "${value}" as "${layout}": cannot parse`,
|
|
1027
1008
|
)
|
|
1028
1009
|
}
|
|
1029
|
-
return
|
|
1010
|
+
return Time.create(date, 0, undefined, loc)
|
|
1030
1011
|
}
|
|
1031
1012
|
|
|
1032
1013
|
// After waits for the duration to elapse and then returns the current time
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goscript",
|
|
3
3
|
"description": "Go to TypeScript transpiler",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.50",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Aperture Robotics LLC.",
|
|
7
7
|
"email": "support@aperture.us",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"release:commit": "git reset && git add package.json && git commit -s -m \"release: v$npm_package_version\" && git tag v$npm_package_version",
|
|
62
62
|
"release:publish": "git push && git push --tags && npm run build && npm publish",
|
|
63
63
|
"lint": "npm run lint:go && npm run lint:js",
|
|
64
|
-
"lint:go": "
|
|
64
|
+
"lint:go": "golangci-lint run .",
|
|
65
65
|
"lint:js": "eslint -c eslint.config.mjs ./",
|
|
66
66
|
"lint:js:fix": "eslint -c eslint.config.mjs ./ --fix",
|
|
67
67
|
"prepare": "husky",
|
package/dist/gs/builtin/io.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Implementation of Go's built-in println function
|
|
3
|
-
* @param args Arguments to print
|
|
4
|
-
*/
|
|
5
|
-
export declare function println(...args: any[]): void;
|
|
6
|
-
/**
|
|
7
|
-
* Implementation of Go's built-in panic function
|
|
8
|
-
* @param args Arguments passed to panic
|
|
9
|
-
*/
|
|
10
|
-
export declare function panic(...args: any[]): void;
|
|
11
|
-
/**
|
|
12
|
-
* Represents the Go error type (interface).
|
|
13
|
-
*/
|
|
14
|
-
export type GoError = {
|
|
15
|
-
Error(): string;
|
|
16
|
-
} | null;
|
package/dist/gs/builtin/io.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Implementation of Go's built-in println function
|
|
3
|
-
* @param args Arguments to print
|
|
4
|
-
*/
|
|
5
|
-
export function println(...args) {
|
|
6
|
-
console.log(...args);
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Implementation of Go's built-in panic function
|
|
10
|
-
* @param args Arguments passed to panic
|
|
11
|
-
*/
|
|
12
|
-
export function panic(...args) {
|
|
13
|
-
throw new Error(`panic: ${args.map((arg) => String(arg)).join(' ')}`);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=io.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../../gs/builtin/io.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,GAAG,IAAW;IACpC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;AACtB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,GAAG,IAAW;IAClC,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AACvE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function Getenv(key: string): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../gs/internal/testlog/index.ts"],"names":[],"mappings":"AAEA,oDAAoD;AAEpD,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,2CAA2C;AAC7C,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as $ from "@goscript/builtin/builtin.js";
|
|
2
|
-
import * as iter from "@goscript/iter/index.js";
|
|
3
|
-
export declare function All<K extends $.Comparable, V>(m: Map<K, V>): iter.Seq2<K, V>;
|
|
4
|
-
export declare function Keys<K extends $.Comparable, V>(m: Map<K, V>): iter.Seq<K>;
|
|
5
|
-
export declare function Values<K extends $.Comparable, V>(m: Map<K, V>): iter.Seq<V>;
|
|
6
|
-
export declare function Insert<K extends $.Comparable, V>(m: Map<K, V>, seq: iter.Seq2<K, V>): void;
|
|
7
|
-
export declare function Collect<K extends $.Comparable, V extends any>(seq: iter.Seq2<K, V>): Map<K, V>;
|
package/dist/gs/maps/iter.gs.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as $ from "@goscript/builtin/builtin.js";
|
|
2
|
-
// All returns an iterator over key-value pairs from m.
|
|
3
|
-
// The iteration order is not specified and is not guaranteed
|
|
4
|
-
// to be the same from one call to the next.
|
|
5
|
-
export function All(m) {
|
|
6
|
-
return (_yield) => {
|
|
7
|
-
for (const [k, v] of m.entries()) {
|
|
8
|
-
{
|
|
9
|
-
if (!_yield(k, v)) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
// Keys returns an iterator over keys in m.
|
|
17
|
-
// The iteration order is not specified and is not guaranteed
|
|
18
|
-
// to be the same from one call to the next.
|
|
19
|
-
export function Keys(m) {
|
|
20
|
-
return (_yield) => {
|
|
21
|
-
for (const [k, _v] of m.entries()) {
|
|
22
|
-
{
|
|
23
|
-
if (!_yield(k)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
// Values returns an iterator over values in m.
|
|
31
|
-
// The iteration order is not specified and is not guaranteed
|
|
32
|
-
// to be the same from one call to the next.
|
|
33
|
-
export function Values(m) {
|
|
34
|
-
return (_yield) => {
|
|
35
|
-
for (const [_k, v] of m.entries()) {
|
|
36
|
-
{
|
|
37
|
-
if (!_yield(v)) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
// Insert adds the key-value pairs from seq to m.
|
|
45
|
-
// If a key in seq already exists in m, its value will be overwritten.
|
|
46
|
-
export function Insert(m, seq) {
|
|
47
|
-
;
|
|
48
|
-
(() => {
|
|
49
|
-
let shouldContinue = true;
|
|
50
|
-
seq((k, v) => {
|
|
51
|
-
{
|
|
52
|
-
$.mapSet(m, k, v);
|
|
53
|
-
}
|
|
54
|
-
return shouldContinue;
|
|
55
|
-
});
|
|
56
|
-
})();
|
|
57
|
-
}
|
|
58
|
-
// Collect collects key-value pairs from seq into a new map
|
|
59
|
-
// and returns it.
|
|
60
|
-
export function Collect(seq) {
|
|
61
|
-
let m = $.makeMap();
|
|
62
|
-
Insert(m, seq);
|
|
63
|
-
return m;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=iter.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iter.gs.js","sourceRoot":"","sources":["../../../gs/maps/iter.gs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,8BAA8B,CAAC;AAIlD,uDAAuD;AACvD,6DAA6D;AAC7D,4CAA4C;AAC5C,MAAM,UAAU,GAAG,CAA4B,CAAY;IAC1D,OAAO,CAAC,MAA0C,EAAQ,EAAE;QAC3D,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;YAClC,CAAC;gBACA,IAAI,CAAC,MAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;oBACpB,OAAM;gBACP,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC,CAAA;AACF,CAAC;AAED,2CAA2C;AAC3C,6DAA6D;AAC7D,4CAA4C;AAC5C,MAAM,UAAU,IAAI,CAA4B,CAAY;IAC3D,OAAO,CAAC,MAAmC,EAAQ,EAAE;QACpD,KAAK,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;YACnC,CAAC;gBACA,IAAI,CAAC,MAAO,CAAC,CAAC,CAAC,EAAE,CAAC;oBACjB,OAAM;gBACP,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC,CAAA;AACF,CAAC;AAED,+CAA+C;AAC/C,6DAA6D;AAC7D,4CAA4C;AAC5C,MAAM,UAAU,MAAM,CAA4B,CAAY;IAC7D,OAAO,CAAC,MAAmC,EAAQ,EAAE;QACpD,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;YACnC,CAAC;gBACA,IAAI,CAAC,MAAO,CAAC,CAAC,CAAC,EAAE,CAAC;oBACjB,OAAM;gBACP,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC,CAAA;AACF,CAAC;AAED,iDAAiD;AACjD,sEAAsE;AACtE,MAAM,UAAU,MAAM,CAA4B,CAAY,EAAE,GAAoB;IACnF,CAAC;IAAA,CAAC,GAAG,EAAE;QACN,IAAI,cAAc,GAAG,IAAI,CAAA;QACzB,GAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACb,CAAC;gBACA,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;YAClB,CAAC;YACD,OAAO,cAAc,CAAA;QACtB,CAAC,CAAC,CAAA;IACH,CAAC,CAAC,EAAE,CAAA;AACL,CAAC;AAED,2DAA2D;AAC3D,kBAAkB;AAClB,MAAM,UAAU,OAAO,CAAwC,GAAoB;IAClF,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAQ,CAAA;IACzB,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IACd,OAAO,CAAC,CAAA;AACT,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as $ from "@goscript/builtin/builtin.js";
|
|
2
|
-
export declare function Equal<K extends $.Comparable, V extends $.Comparable>(m1: Map<K, V>, m2: Map<K, V>): boolean;
|
|
3
|
-
export declare function EqualFunc<K extends $.Comparable, V1, V2>(m1: Map<K, V1>, m2: Map<K, V2>, eq: ((p0: V1, p1: V2) => boolean) | null): boolean;
|
|
4
|
-
export declare function clone<K extends $.Comparable, V>(m: Map<K, V> | null): Map<K, V> | null;
|
|
5
|
-
export declare function Clone<K extends $.Comparable, V>(m: Map<K, V>): Map<K, V>;
|
|
6
|
-
export declare function Copy<K extends $.Comparable, V>(dst: Map<K, V>, src: Map<K, V>): void;
|
|
7
|
-
export declare function DeleteFunc<K extends $.Comparable, V>(m: Map<K, V>, del: ((p0: K, p1: V) => boolean) | null): void;
|
package/dist/gs/maps/maps.gs.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import * as $ from "@goscript/builtin/builtin.js";
|
|
2
|
-
// Equal reports whether two maps contain the same key/value pairs.
|
|
3
|
-
// Values are compared using ==.
|
|
4
|
-
export function Equal(m1, m2) {
|
|
5
|
-
if ($.len(m1) != $.len(m2)) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
for (const [k, v1] of m1.entries()) {
|
|
9
|
-
{
|
|
10
|
-
{
|
|
11
|
-
let [v2, ok] = $.mapGet(m2, k, null);
|
|
12
|
-
if (!ok || v1 != v2) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
// EqualFunc is like Equal, but compares values using eq.
|
|
21
|
-
// Keys are still compared with ==.
|
|
22
|
-
export function EqualFunc(m1, m2, eq) {
|
|
23
|
-
if ($.len(m1) != $.len(m2)) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
for (const [k, v1] of m1.entries()) {
|
|
27
|
-
{
|
|
28
|
-
{
|
|
29
|
-
let [v2, ok] = $.mapGet(m2, k, null);
|
|
30
|
-
if (!ok || !eq(v1, v2)) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
// clone returns a shallow copy of the map.
|
|
39
|
-
export function clone(m) {
|
|
40
|
-
if (m == null) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
const result = $.makeMap();
|
|
44
|
-
for (const [k, v] of m.entries()) {
|
|
45
|
-
$.mapSet(result, k, v);
|
|
46
|
-
}
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
// Clone returns a copy of m. This is a shallow clone:
|
|
50
|
-
// the new keys and values are set using ordinary assignment.
|
|
51
|
-
export function Clone(m) {
|
|
52
|
-
// Preserve nil in case it matters.
|
|
53
|
-
if (m == null) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return clone(m);
|
|
57
|
-
}
|
|
58
|
-
// Copy copies all key/value pairs in src adding them to dst.
|
|
59
|
-
// When a key in src is already present in dst,
|
|
60
|
-
// the value in dst will be overwritten by the value associated
|
|
61
|
-
// with the key in src.
|
|
62
|
-
export function Copy(dst, src) {
|
|
63
|
-
for (const [k, v] of src.entries()) {
|
|
64
|
-
{
|
|
65
|
-
$.mapSet(dst, k, v);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// DeleteFunc deletes any key/value pairs from m for which del returns true.
|
|
70
|
-
export function DeleteFunc(m, del) {
|
|
71
|
-
for (const [k, v] of m.entries()) {
|
|
72
|
-
{
|
|
73
|
-
if (del(k, v)) {
|
|
74
|
-
$.deleteMapEntry(m, k);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=maps.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"maps.gs.js","sourceRoot":"","sources":["../../../gs/maps/maps.gs.ts"],"names":[],"mappings":"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"}
|
package/dist/gs/reflect/abi.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as $ from "@goscript/builtin/builtin.js";
|
|
2
|
-
import { uintptr, Pointer } from "./types.js";
|
|
3
|
-
export interface Type {
|
|
4
|
-
Kind(): number;
|
|
5
|
-
Align(): number;
|
|
6
|
-
Size(): number;
|
|
7
|
-
}
|
|
8
|
-
export declare class abiStep {
|
|
9
|
-
freg: number;
|
|
10
|
-
ireg: number;
|
|
11
|
-
kind: number;
|
|
12
|
-
offset: uintptr;
|
|
13
|
-
size: uintptr;
|
|
14
|
-
stkOff: uintptr;
|
|
15
|
-
constructor(init?: Partial<{
|
|
16
|
-
freg?: number;
|
|
17
|
-
ireg?: number;
|
|
18
|
-
kind?: number;
|
|
19
|
-
offset?: uintptr;
|
|
20
|
-
size?: uintptr;
|
|
21
|
-
stkOff?: uintptr;
|
|
22
|
-
}>);
|
|
23
|
-
}
|
|
24
|
-
export declare class abiSeq {
|
|
25
|
-
iregs: number;
|
|
26
|
-
fregs: number;
|
|
27
|
-
stackBytes: uintptr;
|
|
28
|
-
steps: $.Slice<abiStep>;
|
|
29
|
-
valueStart: $.Slice<number>;
|
|
30
|
-
constructor(init?: Partial<{
|
|
31
|
-
fregs?: number;
|
|
32
|
-
iregs?: number;
|
|
33
|
-
stackBytes?: uintptr;
|
|
34
|
-
steps?: $.Slice<abiStep>;
|
|
35
|
-
valueStart?: $.Slice<number>;
|
|
36
|
-
}>);
|
|
37
|
-
print(): void;
|
|
38
|
-
assignIntN(offset: uintptr, size: uintptr, n: number, ptrMap: number): boolean;
|
|
39
|
-
assignFloatN(offset: uintptr, size: uintptr, n: number): boolean;
|
|
40
|
-
stackAssign(size: uintptr, alignment: uintptr): void;
|
|
41
|
-
regAssign(t: Type | null, offset: uintptr): boolean;
|
|
42
|
-
}
|
|
43
|
-
export declare class abiDesc {
|
|
44
|
-
call: abiSeq;
|
|
45
|
-
ret: abiSeq;
|
|
46
|
-
stackCallArgsSize: uintptr;
|
|
47
|
-
retOffset: uintptr;
|
|
48
|
-
spill: uintptr;
|
|
49
|
-
inRegPtrs: any;
|
|
50
|
-
outRegPtrs: any;
|
|
51
|
-
stackPtrs: any;
|
|
52
|
-
constructor(init?: any);
|
|
53
|
-
dump(): void;
|
|
54
|
-
}
|
|
55
|
-
export declare function newAbiDesc(t: any, rcvr: any): abiDesc;
|
|
56
|
-
export declare function intFromReg(r: any, reg: number, argSize: uintptr, to: Pointer): void;
|
|
57
|
-
export declare function intToReg(r: any, reg: number, argSize: uintptr, from: Pointer): void;
|
|
58
|
-
export declare function floatFromReg(r: any, reg: number, argSize: uintptr, to: Pointer): void;
|
|
59
|
-
export declare function floatToReg(r: any, reg: number, argSize: uintptr, from: Pointer): void;
|