goscript 0.0.47 → 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
@@ -1,4 +1,4 @@
1
- import { ReflectValue, ChanDir, StructField } from './types.js'
1
+ import { ReflectValue, StructField } from './types.js'
2
2
  import { MapIter } from './map.js'
3
3
 
4
4
  // rtype is the common implementation of most values
@@ -10,17 +10,16 @@ export class rtype {
10
10
  }
11
11
 
12
12
  String(): string {
13
- return this.kind.String()
13
+ return Kind_String(this.kind)
14
14
  }
15
15
 
16
16
  Pointers(): boolean {
17
- // Return true for pointer-like types
18
- const k = this.kind.valueOf()
17
+ const k = this.kind
19
18
  return (
20
- k === Ptr.valueOf() ||
21
- k === Map.valueOf() ||
22
- k === Slice.valueOf() ||
23
- k === Interface.valueOf()
19
+ k === Ptr ||
20
+ k === Map ||
21
+ k === Slice ||
22
+ k === Interface
24
23
  )
25
24
  }
26
25
  }
@@ -42,15 +41,14 @@ export class flag {
42
41
  if (typeof _value === 'number') {
43
42
  this._value = _value
44
43
  } else {
45
- this._value = _value.valueOf()
44
+ this._value = _value
46
45
  }
47
46
  }
48
47
 
49
48
  valueOf(): number {
50
- return typeof this._value === 'number' ? this._value : this._value.valueOf()
49
+ return typeof this._value === 'number' ? this._value : this._value
51
50
  }
52
51
 
53
- // Support arithmetic operations
54
52
  static from(value: number | Kind): flag {
55
53
  return new flag(value)
56
54
  }
@@ -80,86 +78,93 @@ export class bitVector {
80
78
  }
81
79
 
82
80
  // Kind represents the specific kind of type that a Type represents.
83
- export class Kind {
84
- constructor(private _value: number) {}
85
-
86
- valueOf(): number {
87
- return this._value
88
- }
89
-
90
- toString(): string {
91
- return this.String()
92
- }
93
-
94
- static from(value: number): Kind {
95
- return new Kind(value)
96
- }
81
+ export type Kind = number
82
+
83
+ // Kind_String returns the string representation of a Kind (wrapper function naming)
84
+ export function Kind_String(k: Kind): string {
85
+ const kindNames = [
86
+ 'invalid',
87
+ 'bool',
88
+ 'int',
89
+ 'int8',
90
+ 'int16',
91
+ 'int32',
92
+ 'int64',
93
+ 'uint',
94
+ 'uint8',
95
+ 'uint16',
96
+ 'uint32',
97
+ 'uint64',
98
+ 'uintptr',
99
+ 'float32',
100
+ 'float64',
101
+ 'complex64',
102
+ 'complex128',
103
+ 'array',
104
+ 'chan',
105
+ 'func',
106
+ 'interface',
107
+ 'map',
108
+ 'ptr',
109
+ 'slice',
110
+ 'string',
111
+ 'struct',
112
+ 'unsafe.Pointer',
113
+ ]
114
+ if (k >= 0 && k < kindNames.length) {
115
+ return kindNames[k]
116
+ }
117
+ return 'invalid'
118
+ }
97
119
 
98
- public String(): string {
99
- const kindNames = [
100
- 'invalid',
101
- 'bool',
102
- 'int',
103
- 'int8',
104
- 'int16',
105
- 'int32',
106
- 'int64',
107
- 'uint',
108
- 'uint8',
109
- 'uint16',
110
- 'uint32',
111
- 'uint64',
112
- 'uintptr',
113
- 'float32',
114
- 'float64',
115
- 'complex64',
116
- 'complex128',
117
- 'array',
118
- 'chan',
119
- 'func',
120
- 'interface',
121
- 'map',
122
- 'ptr',
123
- 'slice',
124
- 'string',
125
- 'struct',
126
- 'unsafe.Pointer',
127
- ]
128
- if (this._value >= 0 && this._value < kindNames.length) {
129
- return kindNames[this._value]
130
- }
131
- return 'invalid'
120
+ // Channel direction constants and type
121
+ export type ChanDir = number
122
+
123
+ export const RecvDir: ChanDir = 1
124
+ export const SendDir: ChanDir = 2
125
+ export const BothDir: ChanDir = 3
126
+
127
+ export function ChanDir_String(d: ChanDir): string {
128
+ switch (d) {
129
+ case RecvDir:
130
+ return "RecvDir"
131
+ case SendDir:
132
+ return "SendDir"
133
+ case BothDir:
134
+ return "BothDir"
135
+ default:
136
+ return "ChanDir(" + d + ")"
132
137
  }
133
138
  }
134
139
 
135
140
  // Kind constants
136
- export const Invalid = new Kind(0)
137
- export const Bool = new Kind(1)
138
- export const Int = new Kind(2)
139
- export const Int8 = new Kind(3)
140
- export const Int16 = new Kind(4)
141
- export const Int32 = new Kind(5)
142
- export const Int64 = new Kind(6)
143
- export const Uint = new Kind(7)
144
- export const Uint8 = new Kind(8)
145
- export const Uint16 = new Kind(9)
146
- export const Uint32 = new Kind(10)
147
- export const Uint64 = new Kind(11)
148
- export const Uintptr = new Kind(12)
149
- export const Float32 = new Kind(13)
150
- export const Float64 = new Kind(14)
151
- export const Complex64 = new Kind(15)
152
- export const Complex128 = new Kind(16)
153
- export const Array = new Kind(17)
154
- export const Chan = new Kind(18)
155
- export const Func = new Kind(19)
156
- export const Interface = new Kind(20)
157
- export const Map = new Kind(21)
158
- export const Ptr = new Kind(22)
159
- export const Slice = new Kind(23)
160
- export const String = new Kind(24)
161
- export const Struct = new Kind(25)
162
- export const UnsafePointer = new Kind(26)
141
+ export const Invalid: Kind = 0
142
+ export const Bool: Kind = 1
143
+ export const Int: Kind = 2
144
+ export const Int8: Kind = 3
145
+ export const Int16: Kind = 4
146
+ export const Int32: Kind = 5
147
+ export const Int64: Kind = 6
148
+ export const Uint: Kind = 7
149
+ export const Uint8: Kind = 8
150
+ export const Uint16: Kind = 9
151
+ export const Uint32: Kind = 10
152
+ export const Uint64: Kind = 11
153
+ export const Uintptr: Kind = 12
154
+ export const Float32: Kind = 13
155
+ export const Float64: Kind = 14
156
+ export const Complex64: Kind = 15
157
+ export const Complex128: Kind = 16
158
+ export const Array: Kind = 17
159
+ export const Chan: Kind = 18
160
+ export const Func: Kind = 19
161
+ export const Interface: Kind = 20
162
+ export const Map: Kind = 21
163
+ export const Ptr: Kind = 22
164
+ export const Slice: Kind = 23
165
+ export const String: Kind = 24
166
+ export const Struct: Kind = 25
167
+ export const UnsafePointer: Kind = 26
163
168
 
164
169
  // Type is the representation of a Go type.
165
170
  export interface Type {
@@ -206,7 +211,7 @@ export class Value {
206
211
  }
207
212
  throw new Error(
208
213
  'reflect: call of reflect.Value.Int on ' +
209
- this._type.Kind().String() +
214
+ Kind_String(this._type.Kind()) +
210
215
  ' Value',
211
216
  )
212
217
  }
@@ -217,7 +222,7 @@ export class Value {
217
222
  }
218
223
  throw new Error(
219
224
  'reflect: call of reflect.Value.Uint on ' +
220
- this._type.Kind().String() +
225
+ Kind_String(this._type.Kind()) +
221
226
  ' Value',
222
227
  )
223
228
  }
@@ -228,7 +233,7 @@ export class Value {
228
233
  }
229
234
  throw new Error(
230
235
  'reflect: call of reflect.Value.Float on ' +
231
- this._type.Kind().String() +
236
+ Kind_String(this._type.Kind()) +
232
237
  ' Value',
233
238
  )
234
239
  }
@@ -239,7 +244,7 @@ export class Value {
239
244
  }
240
245
  throw new Error(
241
246
  'reflect: call of reflect.Value.Bool on ' +
242
- this._type.Kind().String() +
247
+ Kind_String(this._type.Kind()) +
243
248
  ' Value',
244
249
  )
245
250
  }
@@ -249,7 +254,7 @@ export class Value {
249
254
  return this._value
250
255
  }
251
256
  // Special case for bool values - display as <bool Value>
252
- if (this._type.Kind().valueOf() === Bool.valueOf()) {
257
+ if (this._type.Kind() === Bool) {
253
258
  return '<bool Value>'
254
259
  }
255
260
  return this._type.String()
@@ -294,7 +299,7 @@ export class Value {
294
299
 
295
300
  throw new Error(
296
301
  'reflect: call of reflect.Value.Len on ' +
297
- this._type.Kind().String() +
302
+ Kind_String(this._type.Kind()) +
298
303
  ' Value',
299
304
  )
300
305
  }
@@ -321,7 +326,7 @@ export class Value {
321
326
  }
322
327
  throw new Error(
323
328
  'reflect: call of reflect.Value.Index on ' +
324
- this._type.Kind().String() +
329
+ Kind_String(this._type.Kind()) +
325
330
  ' Value',
326
331
  )
327
332
  }
@@ -332,7 +337,7 @@ export class Value {
332
337
  }
333
338
  throw new Error(
334
339
  'reflect: call of reflect.Value.Bytes on ' +
335
- this._type.Kind().String() +
340
+ Kind_String(this._type.Kind()) +
336
341
  ' Value',
337
342
  )
338
343
  }
@@ -401,7 +406,7 @@ export class Value {
401
406
 
402
407
  // Send sends a value to a channel
403
408
  public Send(x: Value): void {
404
- if (this._type.Kind().valueOf() !== Chan.valueOf()) {
409
+ if (this._type.Kind() !== Chan) {
405
410
  throw new Error('reflect: send on non-chan type')
406
411
  }
407
412
 
@@ -711,12 +716,12 @@ class ChannelType implements Type {
711
716
  public String(): string {
712
717
  // Format: chan T, <-chan T, or chan<- T
713
718
  const elem = this._elemType.String()
714
- switch (this._dir.valueOf()) {
715
- case 1: // RecvDir
719
+ switch (this._dir) {
720
+ case RecvDir:
716
721
  return `<-chan ${elem}`
717
- case 2: // SendDir
722
+ case SendDir:
718
723
  return `chan<- ${elem}`
719
- case 3: // BothDir
724
+ case BothDir:
720
725
  default:
721
726
  return `chan ${elem}`
722
727
  }
@@ -995,13 +1000,13 @@ export function ChanOf(dir: ChanDir, t: Type): Type {
995
1000
 
996
1001
  // Additional functions from merged files
997
1002
  export function canRangeFunc(t: Type): boolean {
998
- const kind = t.Kind().valueOf()
999
- return kind === 23 || kind === 17 || kind === 24 // slice, array, string
1003
+ const kind = t.Kind()
1004
+ return kind === Slice || kind === Array || kind === String
1000
1005
  }
1001
1006
 
1002
1007
  export function canRangeFunc2(t: Type): boolean {
1003
- const kind = t.Kind().valueOf()
1004
- return kind === 21 // map
1008
+ const kind = t.Kind()
1009
+ return kind === Map
1005
1010
  }
1006
1011
 
1007
1012
  export function funcLayout(
@@ -34,34 +34,8 @@ export type ReflectValue =
34
34
  | Float32Array
35
35
  | Float64Array
36
36
 
37
- // Channel direction constants and type
38
- export class ChanDir {
39
- constructor(private _value: number) {}
40
-
41
- valueOf(): number {
42
- return this._value
43
- }
44
-
45
- toString(): string {
46
- switch (this._value) {
47
- case 1:
48
- return 'RecvDir'
49
- case 2:
50
- return 'SendDir'
51
- case 3:
52
- return 'BothDir'
53
- default:
54
- return 'InvalidDir'
55
- }
56
- }
57
- }
58
-
59
- export const RecvDir = new ChanDir(1)
60
- export const SendDir = new ChanDir(2)
61
- export const BothDir = new ChanDir(3)
62
-
63
37
  // Import Type and Kind from the main type module
64
- import { Type, Kind, Value } from './type.js'
38
+ import { Type, Kind, Value, Kind_String, ChanDir } from './type.js'
65
39
 
66
40
  // Struct field representation
67
41
  export class StructField {
@@ -205,7 +179,7 @@ export class ValueError extends Error {
205
179
 
206
180
  constructor(init: { Kind: Kind; Method: string }) {
207
181
  super(
208
- `reflect: call of reflect.Value.${init.Method} on ${init.Kind.String()} Value`,
182
+ `reflect: call of reflect.Value.${init.Method} on ${Kind_String(init.Kind)} Value`,
209
183
  )
210
184
  this.Kind = init.Kind
211
185
  this.Method = init.Method
@@ -40,30 +40,30 @@ export { ValueOf } from './type'
40
40
  export function Zero(typ: Type): Value {
41
41
  let zeroValue: ReflectValue
42
42
 
43
- switch (typ.Kind().valueOf()) {
44
- case Bool.valueOf():
43
+ switch (typ.Kind()) {
44
+ case Bool:
45
45
  zeroValue = false
46
46
  break
47
- case Int.valueOf():
48
- case Int8.valueOf():
49
- case Int16.valueOf():
50
- case Int32.valueOf():
51
- case Int64.valueOf():
52
- case Uint.valueOf():
53
- case Uint8.valueOf():
54
- case Uint16.valueOf():
55
- case Uint32.valueOf():
56
- case Uint64.valueOf():
57
- case Uintptr.valueOf():
58
- case Float32.valueOf():
59
- case Float64.valueOf():
47
+ case Int:
48
+ case Int8:
49
+ case Int16:
50
+ case Int32:
51
+ case Int64:
52
+ case Uint:
53
+ case Uint8:
54
+ case Uint16:
55
+ case Uint32:
56
+ case Uint64:
57
+ case Uintptr:
58
+ case Float32:
59
+ case Float64:
60
60
  zeroValue = 0
61
61
  break
62
- case String.valueOf():
62
+ case String:
63
63
  zeroValue = ''
64
64
  break
65
- case Slice.valueOf():
66
- case Array.valueOf():
65
+ case Slice:
66
+ case Array:
67
67
  zeroValue = []
68
68
  break
69
69
  default:
@@ -116,7 +116,7 @@ function getArrayFromValue(value: Value): unknown[] | null {
116
116
  export function Indirect(v: Value): Value {
117
117
  // Check if this is a pointer type
118
118
  const type = v.Type()
119
- if (type.Kind().valueOf() === Ptr.valueOf()) {
119
+ if (type.Kind() === Ptr) {
120
120
  // Ptr kind
121
121
  const elemType = type.Elem()
122
122
  if (elemType) {
@@ -141,7 +141,7 @@ export function New(typ: Type): Value {
141
141
 
142
142
  // MakeSlice returns a Value representing a new slice with the specified type, length, and capacity.
143
143
  export function MakeSlice(typ: Type, len: number, _cap: number): Value {
144
- if (typ.Kind().valueOf() !== Slice.valueOf()) {
144
+ if (typ.Kind() !== Slice) {
145
145
  throw new Error('reflect.MakeSlice of non-slice type')
146
146
  }
147
147
 
@@ -160,7 +160,7 @@ export function MakeSlice(typ: Type, len: number, _cap: number): Value {
160
160
 
161
161
  // MakeMap returns a Value representing a new map with the specified type.
162
162
  export function MakeMap(typ: Type): Value {
163
- if (typ.Kind().valueOf() !== Map.valueOf()) {
163
+ if (typ.Kind() !== Map) {
164
164
  throw new Error('reflect.MakeMap of non-map type')
165
165
  }
166
166
 
@@ -170,7 +170,7 @@ export function MakeMap(typ: Type): Value {
170
170
 
171
171
  // Append appends the values x to a slice and returns the resulting slice.
172
172
  export function Append(s: Value, x: Value): Value {
173
- if (s.Kind().valueOf() !== Slice.valueOf()) {
173
+ if (s.Kind() !== Slice) {
174
174
  throw new Error('reflect.Append of non-slice')
175
175
  }
176
176
 
@@ -187,7 +187,7 @@ export function Append(s: Value, x: Value): Value {
187
187
 
188
188
  // MakeChan returns a Value representing a new channel with the specified type.
189
189
  export function MakeChan(typ: Type, buffer: number): Value {
190
- if (typ.Kind().valueOf() !== Chan.valueOf()) {
190
+ if (typ.Kind() !== Chan) {
191
191
  throw new Error('reflect.MakeChan of non-chan type')
192
192
  }
193
193
 
@@ -15,7 +15,7 @@ export function VisibleFields(t: Type): $.Slice<StructField> {
15
15
  if (t == null) {
16
16
  $.panic('reflect: VisibleFields(nil)')
17
17
  }
18
- if (t!.Kind().valueOf() != 25) {
18
+ if (t!.Kind() != 25) {
19
19
  $.panic('reflect.VisibleFields of non-struct type ' + t!.String())
20
20
  }
21
21
  let w = new visibleFieldsWalker({
@@ -133,13 +133,13 @@ class visibleFieldsWalker {
133
133
  const f = field.clone()
134
134
  f.Index = $.append(null, w.index) as number[]
135
135
  if (f.Anonymous) {
136
- if (f.Type && f.Type.Kind().valueOf() === Ptr.valueOf()) {
136
+ if (f.Type && f.Type.Kind() === Ptr) {
137
137
  const elemType = f.Type.Elem!()
138
138
  if (elemType) {
139
139
  f.Type = elemType
140
140
  }
141
141
  }
142
- if (f.Type && f.Type.Kind().valueOf() === Struct.valueOf()) {
142
+ if (f.Type && f.Type.Kind() === Struct) {
143
143
  w.walk(f.Type)
144
144
  }
145
145
  } else {
@@ -0,0 +1,5 @@
1
+ {
2
+ "dependencies": [
3
+ "errors"
4
+ ]
5
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "dependencies": [
3
+ "errors",
4
+ "io",
5
+ "iter",
6
+ "unicode",
7
+ "unicode/utf8"
8
+ ]
9
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "dependencies": [
3
+ "unsafe"
4
+ ],
5
+ "asyncMethods": {
6
+ "Mutex.Lock": true,
7
+ "RWMutex.Lock": true,
8
+ "RWMutex.RLock": true,
9
+ "WaitGroup.Wait": true,
10
+ "Once.Do": true,
11
+ "Cond.Wait": true,
12
+ "Map.Delete": true,
13
+ "Map.Load": true,
14
+ "Map.LoadAndDelete": true,
15
+ "Map.LoadOrStore": true,
16
+ "Map.Range": true,
17
+ "Map.Store": true
18
+ }
19
+ }