goscript 0.0.48 → 0.0.49

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.
Files changed (152) hide show
  1. package/cmd/goscript/deps.go +1 -4
  2. package/compiler/analysis.go +224 -63
  3. package/compiler/analysis_test.go +112 -0
  4. package/compiler/compiler.go +19 -87
  5. package/compiler/expr-call-type-conversion.go +148 -59
  6. package/compiler/expr-call.go +202 -10
  7. package/compiler/expr.go +5 -82
  8. package/compiler/gs_dependencies_test.go +60 -1
  9. package/compiler/spec-value.go +73 -51
  10. package/compiler/spec.go +293 -151
  11. package/compiler/stmt.go +192 -81
  12. package/dist/gs/builtin/builtin.d.ts +1 -5
  13. package/dist/gs/builtin/builtin.js +1 -34
  14. package/dist/gs/builtin/builtin.js.map +1 -1
  15. package/dist/gs/builtin/slice.js.map +1 -1
  16. package/dist/gs/fmt/fmt.js +20 -4
  17. package/dist/gs/fmt/fmt.js.map +1 -1
  18. package/dist/gs/io/fs/fs.d.ts +6 -12
  19. package/dist/gs/io/fs/fs.js +52 -67
  20. package/dist/gs/io/fs/fs.js.map +1 -1
  21. package/dist/gs/os/index.d.ts +2 -1
  22. package/dist/gs/os/index.js +1 -1
  23. package/dist/gs/os/index.js.map +1 -1
  24. package/dist/gs/os/types_js.gs.d.ts +7 -1
  25. package/dist/gs/os/types_js.gs.js +16 -1
  26. package/dist/gs/os/types_js.gs.js.map +1 -1
  27. package/dist/gs/os/types_unix.gs.js +2 -2
  28. package/dist/gs/os/types_unix.gs.js.map +1 -1
  29. package/dist/gs/reflect/index.d.ts +3 -3
  30. package/dist/gs/reflect/index.js +2 -2
  31. package/dist/gs/reflect/index.js.map +1 -1
  32. package/dist/gs/reflect/map.js +2 -2
  33. package/dist/gs/reflect/map.js.map +1 -1
  34. package/dist/gs/reflect/type.d.ts +8 -9
  35. package/dist/gs/reflect/type.js +101 -103
  36. package/dist/gs/reflect/type.js.map +1 -1
  37. package/dist/gs/reflect/types.d.ts +1 -10
  38. package/dist/gs/reflect/types.js +3 -26
  39. package/dist/gs/reflect/types.js.map +1 -1
  40. package/dist/gs/reflect/value.js +23 -23
  41. package/dist/gs/reflect/value.js.map +1 -1
  42. package/dist/gs/reflect/visiblefields.js +3 -3
  43. package/dist/gs/reflect/visiblefields.js.map +1 -1
  44. package/dist/gs/time/time.d.ts +11 -22
  45. package/dist/gs/time/time.js +29 -57
  46. package/dist/gs/time/time.js.map +1 -1
  47. package/gs/TODO.md +129 -0
  48. package/gs/builtin/builtin.ts +3 -41
  49. package/gs/builtin/slice.ts +1 -1
  50. package/gs/bytes/meta.json +10 -0
  51. package/gs/fmt/fmt.ts +18 -4
  52. package/gs/fmt/meta.json +5 -0
  53. package/gs/internal/meta.json +5 -0
  54. package/gs/io/fs/fs.ts +58 -73
  55. package/gs/io/meta.json +9 -0
  56. package/gs/maps/meta.json +6 -0
  57. package/gs/math/meta.json +5 -0
  58. package/gs/os/index.ts +8 -1
  59. package/gs/os/meta.json +15 -0
  60. package/gs/os/types_js.gs.ts +22 -1
  61. package/gs/os/types_unix.gs.ts +2 -2
  62. package/gs/path/meta.json +6 -0
  63. package/gs/reflect/function-types.test.ts +10 -10
  64. package/gs/reflect/index.ts +6 -6
  65. package/gs/reflect/map.ts +2 -2
  66. package/gs/reflect/meta.json +5 -0
  67. package/gs/reflect/type.ts +108 -103
  68. package/gs/reflect/types.ts +2 -28
  69. package/gs/reflect/value.ts +23 -23
  70. package/gs/reflect/visiblefields.ts +3 -3
  71. package/gs/strconv/meta.json +5 -0
  72. package/gs/strings/meta.json +9 -0
  73. package/gs/sync/meta.json +19 -0
  74. package/gs/time/time.ts +32 -65
  75. package/package.json +1 -1
  76. package/dist/gs/builtin/io.d.ts +0 -16
  77. package/dist/gs/builtin/io.js +0 -15
  78. package/dist/gs/builtin/io.js.map +0 -1
  79. package/dist/gs/internal/testlog/index.d.ts +0 -1
  80. package/dist/gs/internal/testlog/index.js +0 -5
  81. package/dist/gs/internal/testlog/index.js.map +0 -1
  82. package/dist/gs/maps/iter.gs.d.ts +0 -7
  83. package/dist/gs/maps/iter.gs.js +0 -65
  84. package/dist/gs/maps/iter.gs.js.map +0 -1
  85. package/dist/gs/maps/maps.gs.d.ts +0 -7
  86. package/dist/gs/maps/maps.gs.js +0 -79
  87. package/dist/gs/maps/maps.gs.js.map +0 -1
  88. package/dist/gs/reflect/abi.d.ts +0 -59
  89. package/dist/gs/reflect/abi.gs.d.ts +0 -59
  90. package/dist/gs/reflect/abi.gs.js +0 -79
  91. package/dist/gs/reflect/abi.gs.js.map +0 -1
  92. package/dist/gs/reflect/abi.js +0 -79
  93. package/dist/gs/reflect/abi.js.map +0 -1
  94. package/dist/gs/reflect/badlinkname.d.ts +0 -52
  95. package/dist/gs/reflect/badlinkname.gs.d.ts +0 -52
  96. package/dist/gs/reflect/badlinkname.gs.js +0 -72
  97. package/dist/gs/reflect/badlinkname.gs.js.map +0 -1
  98. package/dist/gs/reflect/badlinkname.js +0 -72
  99. package/dist/gs/reflect/badlinkname.js.map +0 -1
  100. package/dist/gs/reflect/deepequal.gs.d.ts +0 -25
  101. package/dist/gs/reflect/deepequal.gs.js +0 -308
  102. package/dist/gs/reflect/deepequal.gs.js.map +0 -1
  103. package/dist/gs/reflect/float32reg_generic.gs.d.ts +0 -2
  104. package/dist/gs/reflect/float32reg_generic.gs.js +0 -10
  105. package/dist/gs/reflect/float32reg_generic.gs.js.map +0 -1
  106. package/dist/gs/reflect/index.gs.d.ts +0 -1
  107. package/dist/gs/reflect/index.gs.js +0 -3
  108. package/dist/gs/reflect/index.gs.js.map +0 -1
  109. package/dist/gs/reflect/iter.gs.d.ts +0 -3
  110. package/dist/gs/reflect/iter.gs.js +0 -24
  111. package/dist/gs/reflect/iter.gs.js.map +0 -1
  112. package/dist/gs/reflect/makefunc.gs.d.ts +0 -34
  113. package/dist/gs/reflect/makefunc.gs.js +0 -288
  114. package/dist/gs/reflect/makefunc.gs.js.map +0 -1
  115. package/dist/gs/reflect/map_swiss.gs.d.ts +0 -14
  116. package/dist/gs/reflect/map_swiss.gs.js +0 -70
  117. package/dist/gs/reflect/map_swiss.gs.js.map +0 -1
  118. package/dist/gs/reflect/reflect.gs.d.ts +0 -132
  119. package/dist/gs/reflect/reflect.gs.js +0 -437
  120. package/dist/gs/reflect/reflect.gs.js.map +0 -1
  121. package/dist/gs/reflect/swapper.gs.d.ts +0 -1
  122. package/dist/gs/reflect/swapper.gs.js +0 -32
  123. package/dist/gs/reflect/swapper.gs.js.map +0 -1
  124. package/dist/gs/reflect/type.gs.d.ts +0 -4
  125. package/dist/gs/reflect/type.gs.js +0 -21
  126. package/dist/gs/reflect/type.gs.js.map +0 -1
  127. package/dist/gs/reflect/value.gs.d.ts +0 -4
  128. package/dist/gs/reflect/value.gs.js +0 -12
  129. package/dist/gs/reflect/value.gs.js.map +0 -1
  130. package/dist/gs/reflect/visiblefields.gs.d.ts +0 -3
  131. package/dist/gs/reflect/visiblefields.gs.js +0 -123
  132. package/dist/gs/reflect/visiblefields.gs.js.map +0 -1
  133. package/dist/gs/stringslite/index.d.ts +0 -1
  134. package/dist/gs/stringslite/index.js +0 -2
  135. package/dist/gs/stringslite/index.js.map +0 -1
  136. package/dist/gs/stringslite/strings.d.ts +0 -11
  137. package/dist/gs/stringslite/strings.js +0 -67
  138. package/dist/gs/stringslite/strings.js.map +0 -1
  139. package/gs/bytes/metadata.go +0 -12
  140. package/gs/fmt/metadata.go +0 -7
  141. package/gs/internal/metadata.go +0 -7
  142. package/gs/io/io.go +0 -75
  143. package/gs/io/metadata.go +0 -11
  144. package/gs/maps/metadata.go +0 -8
  145. package/gs/math/metadata.go +0 -7
  146. package/gs/os/metadata.go +0 -17
  147. package/gs/path/metadata.go +0 -8
  148. package/gs/reflect/metadata.go +0 -7
  149. package/gs/strconv/metadata.go +0 -7
  150. package/gs/strings/metadata.go +0 -11
  151. package/gs/sync/metadata.go +0 -7
  152. package/gs/sync/sync.go +0 -64
package/gs/time/time.ts CHANGED
@@ -45,13 +45,13 @@ export class Time {
45
45
  }
46
46
 
47
47
  // Weekday returns the day of the week specified by t
48
- public Weekday(): WeekdayValue {
48
+ public Weekday(): Weekday {
49
49
  if (this._location.offsetSeconds !== undefined) {
50
50
  const offsetMs = this._location.offsetSeconds * 1000
51
51
  const adjustedTime = new globalThis.Date(this._date.getTime() + offsetMs)
52
- return new WeekdayValue(adjustedTime.getUTCDay() as Weekday)
52
+ return adjustedTime.getUTCDay() as Weekday
53
53
  }
54
- return new WeekdayValue(this._date.getDay() as Weekday)
54
+ return this._date.getDay() as Weekday
55
55
  }
56
56
 
57
57
  // Day returns the day of the month specified by t
@@ -473,19 +473,19 @@ export class Time {
473
473
  // If both times have monotonic readings, use them for more accurate duration calculation
474
474
  if (this._monotonic !== undefined && u._monotonic !== undefined) {
475
475
  const diffNs = this._monotonic - u._monotonic
476
- return new Duration(diffNs)
476
+ return diffNs
477
477
  }
478
478
 
479
479
  // Fallback to Date-based calculation
480
480
  const diffMs = this._date.getTime() - u._date.getTime()
481
481
  const diffNs = this._nsec - u._nsec
482
- return new Duration(diffMs * 1000000 + diffNs) // Convert ms to ns and add ns difference
482
+ return diffMs * 1000000 + diffNs
483
483
  }
484
484
 
485
485
  // Add adds the duration d to t, returning the sum
486
486
  // Preserves monotonic reading if present
487
487
  public Add(d: Duration): Time {
488
- const durationNs = d.valueOf()
488
+ const durationNs = d
489
489
  const newDate = new globalThis.Date(
490
490
  this._date.getTime() + Math.floor(durationNs / 1000000),
491
491
  )
@@ -563,38 +563,17 @@ export class Time {
563
563
  }
564
564
  }
565
565
 
566
- // Duration represents a span of time
567
- export class Duration {
568
- private _nanoseconds: number
566
+ // Duration represents a span of time (nanoseconds)
567
+ export type Duration = number
569
568
 
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
- }
588
-
589
- // valueOf returns the primitive number value, allowing direct comparison with < > etc
590
- public valueOf(): number {
591
- return this._nanoseconds
592
- }
569
+ // Duration comparison function
570
+ export function Duration_lt(receiver: Duration, other: Duration): boolean {
571
+ return receiver < other
572
+ }
593
573
 
594
- // toString for string representation
595
- public toString(): string {
596
- return this._nanoseconds.toString() + 'ns'
597
- }
574
+ // Duration multiplication function
575
+ export function Duration_multiply(receiver: Duration, multiplier: number): Duration {
576
+ return receiver * multiplier
598
577
  }
599
578
 
600
579
  // Override multiplication operator for Duration * number
@@ -602,7 +581,7 @@ export function multiplyDuration(
602
581
  duration: Duration,
603
582
  multiplier: number,
604
583
  ): Duration {
605
- return Duration.multiply(duration, multiplier)
584
+ return duration * multiplier
606
585
  }
607
586
 
608
587
  // Location represents a time zone
@@ -670,21 +649,9 @@ export function WeekdayString(w: Weekday): string {
670
649
  return names[w] || 'Unknown'
671
650
  }
672
651
 
673
- // WeekdayValue wraps a Weekday enum value and provides methods
674
- export class WeekdayValue {
675
- private _value: Weekday
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
- }
652
+ // Weekday_String returns the string representation of a Weekday (wrapper function naming)
653
+ export function Weekday_String(w: Weekday): string {
654
+ return WeekdayString(w)
688
655
  }
689
656
 
690
657
  // ParseError describes a problem parsing a time string
@@ -721,7 +688,7 @@ export class Timer {
721
688
  constructor(duration: Duration, callback?: () => void) {
722
689
  this._duration = duration
723
690
  this._callback = callback
724
- const ms = duration.valueOf() / 1000000 // Convert nanoseconds to milliseconds
691
+ const ms = duration / 1000000 // Convert nanoseconds to milliseconds
725
692
 
726
693
  if (callback) {
727
694
  this._timeout = setTimeout(callback, ms)
@@ -743,7 +710,7 @@ export class Timer {
743
710
  // Reset changes the timer to expire after duration d
744
711
  public Reset(d: Duration): boolean {
745
712
  this.Stop()
746
- const ms = d.valueOf() / 1000000
713
+ const ms = d / 1000000
747
714
  if (this._callback) {
748
715
  this._timeout = setTimeout(this._callback, ms)
749
716
  } else {
@@ -761,7 +728,7 @@ export class Ticker {
761
728
 
762
729
  constructor(duration: Duration) {
763
730
  this._duration = duration
764
- const ms = duration.valueOf() / 1000000 // Convert nanoseconds to milliseconds
731
+ const ms = duration / 1000000 // Convert nanoseconds to milliseconds
765
732
  this._interval = setInterval(() => {}, ms)
766
733
  }
767
734
 
@@ -780,13 +747,13 @@ export class Ticker {
780
747
  this.Stop()
781
748
  this._stopped = false
782
749
  this._duration = d
783
- const ms = d.valueOf() / 1000000
750
+ const ms = d / 1000000
784
751
  this._interval = setInterval(() => {}, ms)
785
752
  }
786
753
 
787
754
  // Channel returns an async iterator that yields time values
788
755
  public async *Channel(): AsyncIterableIterator<Time> {
789
- const ms = this._duration.valueOf() / 1000000
756
+ const ms = this._duration / 1000000
790
757
  while (!this._stopped) {
791
758
  await new Promise((resolve) => setTimeout(resolve, ms))
792
759
  if (!this._stopped) {
@@ -865,12 +832,12 @@ export function FixedZone(name: string, offset: number): Location {
865
832
  }
866
833
 
867
834
  // Common durations (matching Go's time package constants)
868
- export const Nanosecond = new Duration(1)
869
- export const Microsecond = new Duration(1000)
870
- export const Millisecond = new Duration(1000000)
871
- export const Second = new Duration(1000000000)
872
- export const Minute = new Duration(60000000000)
873
- export const Hour = new Duration(3600000000000)
835
+ export const Nanosecond = 1
836
+ export const Microsecond = 1000
837
+ export const Millisecond = 1000000
838
+ export const Second = 1000000000
839
+ export const Minute = 60000000000
840
+ export const Hour = 3600000000000
874
841
 
875
842
  // Since returns the time elapsed since t
876
843
  // Uses monotonic clock if available for accurate measurement
@@ -886,7 +853,7 @@ export function Until(t: Time): Duration {
886
853
 
887
854
  // Sleep pauses the current execution for at least the duration d
888
855
  export async function Sleep(d: Duration): Promise<void> {
889
- const ms = d.valueOf() / 1000000 // Convert nanoseconds to milliseconds
856
+ const ms = d / 1000000 // Convert nanoseconds to milliseconds
890
857
  return new Promise((resolve) => setTimeout(resolve, ms))
891
858
  }
892
859
 
@@ -969,7 +936,7 @@ export function ParseDuration(s: string): Duration {
969
936
  throw new Error(`time: unknown unit "${unit}" in duration "${s}"`)
970
937
  }
971
938
 
972
- return new Duration(Math.floor(nanoseconds))
939
+ return nanoseconds
973
940
  }
974
941
 
975
942
  // Parse parses a formatted string and returns the time value it represents
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.48",
4
+ "version": "0.0.49",
5
5
  "author": {
6
6
  "name": "Aperture Robotics LLC.",
7
7
  "email": "support@aperture.us",
@@ -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;
@@ -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,5 +0,0 @@
1
- // Stub implementations for internal/testlog package
2
- export function Getenv(key) {
3
- // Stub for test logging - no-op in runtime
4
- }
5
- //# sourceMappingURL=index.js.map
@@ -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>;
@@ -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,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+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;
@@ -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":"AAAA,OAAO,KAAK,CAAC,MAAM,8BAA8B,CAAC;AAIlD,mEAAmE;AACnE,gCAAgC;AAChC,MAAM,UAAU,KAAK,CAAiD,EAAa,EAAE,EAAa;IACjG,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAA;IACb,CAAC;IACD,KAAK,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QACpC,CAAC;YACA,CAAC;gBACA,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,IAAW,CAAC,CAAA;gBAC3C,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;oBACrB,OAAO,KAAK,CAAA;gBACb,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAA;AACZ,CAAC;AAED,yDAAyD;AACzD,mCAAmC;AACnC,MAAM,UAAU,SA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AAC/C,+DAA+D;AAC/D,uBAAuB;AACvB,MAAM,UAAU,IAAI,CAA4B,GAAc,EAAE,GAAc;IAC7E,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;QACpC,CAAC;YACA,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACpB,CAAC;IACF,CAAC;AACF,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,UAAU,CAA4B,CAAY,EAAE,GAAuC;IAC1G,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAClC,CAAC;YACA,IAAI,GAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;gBAChB,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YACvB,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -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;
@@ -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;
@@ -1,79 +0,0 @@
1
- import * as $ from "@goscript/builtin/builtin.js";
2
- export class abiStep {
3
- freg = 0;
4
- ireg = 0;
5
- kind = 0;
6
- offset = 0;
7
- size = 0;
8
- stkOff = 0;
9
- constructor(init) {
10
- if (init) {
11
- Object.assign(this, init);
12
- }
13
- }
14
- }
15
- export class abiSeq {
16
- iregs = 0;
17
- fregs = 0;
18
- stackBytes = 0;
19
- steps = $.makeSlice(0, 0);
20
- valueStart = $.makeSlice(0, 0);
21
- constructor(init) {
22
- if (init) {
23
- Object.assign(this, init);
24
- }
25
- }
26
- print() {
27
- // Stub implementation
28
- }
29
- assignIntN(offset, size, n, ptrMap) {
30
- // Stub implementation
31
- return false;
32
- }
33
- assignFloatN(offset, size, n) {
34
- // Stub implementation
35
- return false;
36
- }
37
- stackAssign(size, alignment) {
38
- // Stub implementation
39
- }
40
- regAssign(t, offset) {
41
- // Stub implementation
42
- return false;
43
- }
44
- }
45
- export class abiDesc {
46
- call = new abiSeq();
47
- ret = new abiSeq();
48
- stackCallArgsSize = 0;
49
- retOffset = 0;
50
- spill = 0;
51
- inRegPtrs = {};
52
- outRegPtrs = {};
53
- stackPtrs = null;
54
- constructor(init) {
55
- if (init) {
56
- Object.assign(this, init);
57
- }
58
- }
59
- dump() {
60
- // Stub implementation
61
- }
62
- }
63
- // Stub functions
64
- export function newAbiDesc(t, rcvr) {
65
- return new abiDesc();
66
- }
67
- export function intFromReg(r, reg, argSize, to) {
68
- // Stub implementation
69
- }
70
- export function intToReg(r, reg, argSize, from) {
71
- // Stub implementation
72
- }
73
- export function floatFromReg(r, reg, argSize, to) {
74
- // Stub implementation
75
- }
76
- export function floatToReg(r, reg, argSize, from) {
77
- // Stub implementation
78
- }
79
- //# sourceMappingURL=abi.gs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"abi.gs.js","sourceRoot":"","sources":["../../../gs/reflect/abi.gs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,8BAA8B,CAAC;AAWlD,MAAM,OAAO,OAAO;IACZ,IAAI,GAAW,CAAC,CAAC;IACjB,IAAI,GAAW,CAAC,CAAC;IACjB,IAAI,GAAW,CAAC,CAAC;IACjB,MAAM,GAAY,CAAC,CAAC;IACpB,IAAI,GAAY,CAAC,CAAC;IAClB,MAAM,GAAY,CAAC,CAAC;IAE3B,YAAY,IAAiH;QAC5H,IAAI,IAAI,EAAE,CAAC;YACV,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC;CACD;AAED,MAAM,OAAO,MAAM;IACX,KAAK,GAAW,CAAC,CAAC;IAClB,KAAK,GAAW,CAAC,CAAC;IAClB,UAAU,GAAY,CAAC,CAAC;IACxB,KAAK,GAAqB,CAAC,CAAC,SAAS,CAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IACrD,UAAU,GAAoB,CAAC,CAAC,SAAS,CAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IAE/D,YAAY,IAA8H;QACzI,IAAI,IAAI,EAAE,CAAC;YACV,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC;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