goscript 0.0.34 → 0.0.36

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 (358) hide show
  1. package/compiler/analysis.go +28 -20
  2. package/compiler/analysis_test.go +14 -0
  3. package/compiler/assignment.go +19 -7
  4. package/compiler/compiler.go +15 -99
  5. package/compiler/composite-lit.go +60 -17
  6. package/compiler/decl.go +1 -1
  7. package/compiler/expr-call.go +233 -35
  8. package/compiler/expr-selector.go +28 -2
  9. package/compiler/expr.go +13 -37
  10. package/compiler/lit.go +111 -2
  11. package/compiler/primitive.go +6 -6
  12. package/compiler/protobuf.go +0 -5
  13. package/compiler/sanitize.go +101 -0
  14. package/compiler/spec-struct.go +41 -8
  15. package/compiler/spec-value.go +29 -18
  16. package/compiler/stmt-assign.go +22 -1
  17. package/compiler/stmt.go +26 -9
  18. package/compiler/type.go +3 -3
  19. package/dist/gs/builtin/builtin.d.ts +3 -2
  20. package/dist/gs/builtin/builtin.js +2 -1
  21. package/dist/gs/builtin/builtin.js.map +1 -1
  22. package/dist/gs/builtin/map.js.map +1 -1
  23. package/dist/gs/builtin/slice.d.ts +7 -1
  24. package/dist/gs/builtin/slice.js +112 -22
  25. package/dist/gs/builtin/slice.js.map +1 -1
  26. package/dist/gs/github.com/pkg/errors/errors.d.ts +13 -0
  27. package/dist/gs/github.com/pkg/errors/errors.js +232 -0
  28. package/dist/gs/github.com/pkg/errors/errors.js.map +1 -0
  29. package/dist/gs/github.com/pkg/errors/go113.d.ts +4 -0
  30. package/dist/gs/github.com/pkg/errors/go113.js +34 -0
  31. package/dist/gs/github.com/pkg/errors/go113.js.map +1 -0
  32. package/dist/gs/github.com/pkg/errors/index.d.ts +3 -0
  33. package/dist/gs/github.com/pkg/errors/index.js +4 -0
  34. package/dist/gs/github.com/pkg/errors/index.js.map +1 -0
  35. package/dist/gs/github.com/pkg/errors/stack.d.ts +32 -0
  36. package/dist/gs/github.com/pkg/errors/stack.js +111 -0
  37. package/dist/gs/github.com/pkg/errors/stack.js.map +1 -0
  38. package/dist/gs/maps/index.d.ts +2 -2
  39. package/dist/gs/maps/index.js +2 -2
  40. package/dist/gs/maps/index.js.map +1 -1
  41. package/dist/gs/maps/iter.d.ts +7 -0
  42. package/dist/gs/maps/iter.js +57 -0
  43. package/dist/gs/maps/iter.js.map +1 -0
  44. package/dist/gs/maps/maps.d.ts +7 -0
  45. package/dist/gs/maps/maps.js +67 -0
  46. package/dist/gs/maps/maps.js.map +1 -0
  47. package/dist/gs/math/abs.gs.d.ts +1 -0
  48. package/dist/gs/math/abs.gs.js +10 -0
  49. package/dist/gs/math/abs.gs.js.map +1 -0
  50. package/dist/gs/math/acosh.gs.d.ts +2 -0
  51. package/dist/gs/math/acosh.gs.js +14 -0
  52. package/dist/gs/math/acosh.gs.js.map +1 -0
  53. package/dist/gs/math/asin.gs.d.ts +4 -0
  54. package/dist/gs/math/asin.gs.js +24 -0
  55. package/dist/gs/math/asin.gs.js.map +1 -0
  56. package/dist/gs/math/asinh.gs.d.ts +2 -0
  57. package/dist/gs/math/asinh.gs.js +14 -0
  58. package/dist/gs/math/asinh.gs.js.map +1 -0
  59. package/dist/gs/math/atan.gs.d.ts +4 -0
  60. package/dist/gs/math/atan.gs.js +22 -0
  61. package/dist/gs/math/atan.gs.js.map +1 -0
  62. package/dist/gs/math/atan2.gs.d.ts +2 -0
  63. package/dist/gs/math/atan2.gs.js +30 -0
  64. package/dist/gs/math/atan2.gs.js.map +1 -0
  65. package/dist/gs/math/atanh.gs.d.ts +2 -0
  66. package/dist/gs/math/atanh.gs.js +16 -0
  67. package/dist/gs/math/atanh.gs.js.map +1 -0
  68. package/dist/gs/math/bits.gs.d.ts +5 -0
  69. package/dist/gs/math/bits.gs.js +46 -0
  70. package/dist/gs/math/bits.gs.js.map +1 -0
  71. package/dist/gs/math/cbrt.gs.d.ts +2 -0
  72. package/dist/gs/math/cbrt.gs.js +14 -0
  73. package/dist/gs/math/cbrt.gs.js.map +1 -0
  74. package/dist/gs/math/const.gs.d.ts +30 -0
  75. package/dist/gs/math/const.gs.js +61 -0
  76. package/dist/gs/math/const.gs.js.map +1 -0
  77. package/dist/gs/math/copysign.gs.d.ts +1 -0
  78. package/dist/gs/math/copysign.gs.js +20 -0
  79. package/dist/gs/math/copysign.gs.js.map +1 -0
  80. package/dist/gs/math/dim.gs.d.ts +5 -0
  81. package/dist/gs/math/dim.gs.js +69 -0
  82. package/dist/gs/math/dim.gs.js.map +1 -0
  83. package/dist/gs/math/erf.gs.d.ts +4 -0
  84. package/dist/gs/math/erf.gs.js +336 -0
  85. package/dist/gs/math/erf.gs.js.map +1 -0
  86. package/dist/gs/math/erfinv.gs.d.ts +2 -0
  87. package/dist/gs/math/erfinv.gs.js +118 -0
  88. package/dist/gs/math/erfinv.gs.js.map +1 -0
  89. package/dist/gs/math/exp.gs.d.ts +5 -0
  90. package/dist/gs/math/exp.gs.js +30 -0
  91. package/dist/gs/math/exp.gs.js.map +1 -0
  92. package/dist/gs/math/expm1.gs.d.ts +2 -0
  93. package/dist/gs/math/expm1.gs.js +17 -0
  94. package/dist/gs/math/expm1.gs.js.map +1 -0
  95. package/dist/gs/math/floor.gs.d.ts +8 -0
  96. package/dist/gs/math/floor.gs.js +75 -0
  97. package/dist/gs/math/floor.gs.js.map +1 -0
  98. package/dist/gs/math/fma.gs.d.ts +1 -0
  99. package/dist/gs/math/fma.gs.js +8 -0
  100. package/dist/gs/math/fma.gs.js.map +1 -0
  101. package/dist/gs/math/frexp.gs.d.ts +2 -0
  102. package/dist/gs/math/frexp.gs.js +28 -0
  103. package/dist/gs/math/frexp.gs.js.map +1 -0
  104. package/dist/gs/math/gamma.gs.d.ts +3 -0
  105. package/dist/gs/math/gamma.gs.js +149 -0
  106. package/dist/gs/math/gamma.gs.js.map +1 -0
  107. package/dist/gs/math/hypot.gs.d.ts +2 -0
  108. package/dist/gs/math/hypot.gs.js +16 -0
  109. package/dist/gs/math/hypot.gs.js.map +1 -0
  110. package/dist/gs/math/index.d.ts +44 -0
  111. package/dist/gs/math/index.js +45 -0
  112. package/dist/gs/math/index.js.map +1 -0
  113. package/dist/gs/math/j0.gs.d.ts +4 -0
  114. package/dist/gs/math/j0.gs.js +228 -0
  115. package/dist/gs/math/j0.gs.js.map +1 -0
  116. package/dist/gs/math/j1.gs.d.ts +4 -0
  117. package/dist/gs/math/j1.gs.js +211 -0
  118. package/dist/gs/math/j1.gs.js.map +1 -0
  119. package/dist/gs/math/jn.gs.d.ts +2 -0
  120. package/dist/gs/math/jn.gs.js +412 -0
  121. package/dist/gs/math/jn.gs.js.map +1 -0
  122. package/dist/gs/math/ldexp.gs.d.ts +2 -0
  123. package/dist/gs/math/ldexp.gs.js +20 -0
  124. package/dist/gs/math/ldexp.gs.js.map +1 -0
  125. package/dist/gs/math/lgamma.gs.d.ts +2 -0
  126. package/dist/gs/math/lgamma.gs.js +243 -0
  127. package/dist/gs/math/lgamma.gs.js.map +1 -0
  128. package/dist/gs/math/log.gs.d.ts +2 -0
  129. package/dist/gs/math/log.gs.js +16 -0
  130. package/dist/gs/math/log.gs.js.map +1 -0
  131. package/dist/gs/math/log10.gs.d.ts +4 -0
  132. package/dist/gs/math/log10.gs.js +17 -0
  133. package/dist/gs/math/log10.gs.js.map +1 -0
  134. package/dist/gs/math/log1p.gs.d.ts +2 -0
  135. package/dist/gs/math/log1p.gs.js +17 -0
  136. package/dist/gs/math/log1p.gs.js.map +1 -0
  137. package/dist/gs/math/logb.gs.d.ts +3 -0
  138. package/dist/gs/math/logb.gs.js +43 -0
  139. package/dist/gs/math/logb.gs.js.map +1 -0
  140. package/dist/gs/math/mod.gs.d.ts +2 -0
  141. package/dist/gs/math/mod.gs.js +26 -0
  142. package/dist/gs/math/mod.gs.js.map +1 -0
  143. package/dist/gs/math/modf.gs.d.ts +2 -0
  144. package/dist/gs/math/modf.gs.js +24 -0
  145. package/dist/gs/math/modf.gs.js.map +1 -0
  146. package/dist/gs/math/nextafter.gs.d.ts +2 -0
  147. package/dist/gs/math/nextafter.gs.js +66 -0
  148. package/dist/gs/math/nextafter.gs.js.map +1 -0
  149. package/dist/gs/math/pow.gs.d.ts +3 -0
  150. package/dist/gs/math/pow.gs.js +40 -0
  151. package/dist/gs/math/pow.gs.js.map +1 -0
  152. package/dist/gs/math/pow10.gs.d.ts +1 -0
  153. package/dist/gs/math/pow10.gs.js +14 -0
  154. package/dist/gs/math/pow10.gs.js.map +1 -0
  155. package/dist/gs/math/remainder.gs.d.ts +2 -0
  156. package/dist/gs/math/remainder.gs.js +25 -0
  157. package/dist/gs/math/remainder.gs.js.map +1 -0
  158. package/dist/gs/math/signbit.gs.d.ts +1 -0
  159. package/dist/gs/math/signbit.gs.js +5 -0
  160. package/dist/gs/math/signbit.gs.js.map +1 -0
  161. package/dist/gs/math/sin.gs.d.ts +4 -0
  162. package/dist/gs/math/sin.gs.js +29 -0
  163. package/dist/gs/math/sin.gs.js.map +1 -0
  164. package/dist/gs/math/sincos.gs.d.ts +1 -0
  165. package/dist/gs/math/sincos.gs.js +11 -0
  166. package/dist/gs/math/sincos.gs.js.map +1 -0
  167. package/dist/gs/math/sinh.gs.d.ts +4 -0
  168. package/dist/gs/math/sinh.gs.js +27 -0
  169. package/dist/gs/math/sinh.gs.js.map +1 -0
  170. package/dist/gs/math/sqrt.gs.d.ts +2 -0
  171. package/dist/gs/math/sqrt.gs.js +15 -0
  172. package/dist/gs/math/sqrt.gs.js.map +1 -0
  173. package/dist/gs/math/tan.gs.d.ts +2 -0
  174. package/dist/gs/math/tan.gs.js +17 -0
  175. package/dist/gs/math/tan.gs.js.map +1 -0
  176. package/dist/gs/math/tanh.gs.d.ts +2 -0
  177. package/dist/gs/math/tanh.gs.js +17 -0
  178. package/dist/gs/math/tanh.gs.js.map +1 -0
  179. package/dist/gs/math/trig_reduce.gs.d.ts +1 -0
  180. package/dist/gs/math/trig_reduce.gs.js +62 -0
  181. package/dist/gs/math/trig_reduce.gs.js.map +1 -0
  182. package/dist/gs/math/unsafe.gs.d.ts +4 -0
  183. package/dist/gs/math/unsafe.gs.js +47 -0
  184. package/dist/gs/math/unsafe.gs.js.map +1 -0
  185. package/dist/gs/strconv/atob.gs.d.ts +4 -0
  186. package/dist/gs/strconv/atob.gs.js +42 -0
  187. package/dist/gs/strconv/atob.gs.js.map +1 -0
  188. package/dist/gs/strconv/atof.gs.d.ts +2 -0
  189. package/dist/gs/strconv/atof.gs.js +51 -0
  190. package/dist/gs/strconv/atof.gs.js.map +1 -0
  191. package/dist/gs/strconv/atoi.gs.d.ts +33 -0
  192. package/dist/gs/strconv/atoi.gs.js +200 -0
  193. package/dist/gs/strconv/atoi.gs.js.map +1 -0
  194. package/dist/gs/strconv/doc.gs.d.ts +1 -0
  195. package/dist/gs/strconv/doc.gs.js +2 -0
  196. package/dist/gs/strconv/doc.gs.js.map +1 -0
  197. package/dist/gs/strconv/ftoa.gs.d.ts +3 -0
  198. package/dist/gs/strconv/ftoa.gs.js +58 -0
  199. package/dist/gs/strconv/ftoa.gs.js.map +1 -0
  200. package/dist/gs/strconv/index.d.ts +6 -0
  201. package/dist/gs/strconv/index.js +7 -0
  202. package/dist/gs/strconv/index.js.map +1 -0
  203. package/dist/gs/strconv/itoa.gs.d.ts +6 -0
  204. package/dist/gs/strconv/itoa.gs.js +37 -0
  205. package/dist/gs/strconv/itoa.gs.js.map +1 -0
  206. package/dist/gs/strconv/quote.gs.d.ts +19 -0
  207. package/dist/gs/strconv/quote.gs.js +217 -0
  208. package/dist/gs/strconv/quote.gs.js.map +1 -0
  209. package/dist/gs/strings/index.d.ts +3 -0
  210. package/dist/gs/strings/index.js +4 -0
  211. package/dist/gs/strings/index.js.map +1 -1
  212. package/dist/gs/strings/replace.d.ts +0 -74
  213. package/dist/gs/strings/replace.js +6 -204
  214. package/dist/gs/strings/replace.js.map +1 -1
  215. package/dist/gs/strings/search.d.ts +0 -1
  216. package/dist/gs/strings/search.js +0 -21
  217. package/dist/gs/strings/search.js.map +1 -1
  218. package/dist/gs/sync/atomic/doc.gs.d.ts +28 -0
  219. package/dist/gs/sync/atomic/doc.gs.js +265 -0
  220. package/dist/gs/sync/atomic/doc.gs.js.map +1 -0
  221. package/dist/gs/sync/atomic/doc_64.gs.d.ts +15 -0
  222. package/dist/gs/sync/atomic/doc_64.gs.js +165 -0
  223. package/dist/gs/sync/atomic/doc_64.gs.js.map +1 -0
  224. package/dist/gs/sync/atomic/index.d.ts +4 -0
  225. package/dist/gs/sync/atomic/index.js +5 -0
  226. package/dist/gs/sync/atomic/index.js.map +1 -0
  227. package/dist/gs/sync/atomic/type.gs.d.ts +130 -0
  228. package/dist/gs/sync/atomic/type.gs.js +433 -0
  229. package/dist/gs/sync/atomic/type.gs.js.map +1 -0
  230. package/dist/gs/sync/atomic/value.gs.d.ts +19 -0
  231. package/dist/gs/sync/atomic/value.gs.js +116 -0
  232. package/dist/gs/sync/atomic/value.gs.js.map +1 -0
  233. package/dist/gs/unsafe/unsafe.d.ts +1 -0
  234. package/dist/gs/unsafe/unsafe.js +5 -0
  235. package/dist/gs/unsafe/unsafe.js.map +1 -1
  236. package/gs/builtin/builtin.ts +9 -7
  237. package/gs/builtin/map.ts +5 -1
  238. package/gs/builtin/slice.ts +152 -24
  239. package/gs/github.com/pkg/errors/errors.ts +307 -0
  240. package/gs/github.com/pkg/errors/go113.ts +39 -0
  241. package/gs/github.com/pkg/errors/index.ts +3 -0
  242. package/gs/github.com/pkg/errors/stack.ts +127 -0
  243. package/gs/maps/index.ts +2 -2
  244. package/gs/maps/iter.ts +67 -0
  245. package/gs/maps/maps.ts +89 -0
  246. package/gs/math/TODO.md +156 -0
  247. package/gs/math/abs.gs.test.ts +29 -0
  248. package/gs/math/abs.gs.ts +13 -0
  249. package/gs/math/acosh.gs.test.ts +39 -0
  250. package/gs/math/acosh.gs.ts +21 -0
  251. package/gs/math/asin.gs.test.ts +66 -0
  252. package/gs/math/asin.gs.ts +27 -0
  253. package/gs/math/asinh.gs.test.ts +37 -0
  254. package/gs/math/asinh.gs.ts +21 -0
  255. package/gs/math/atan.gs.test.ts +49 -0
  256. package/gs/math/atan.gs.ts +27 -0
  257. package/gs/math/atan2.gs.test.ts +55 -0
  258. package/gs/math/atan2.gs.ts +37 -0
  259. package/gs/math/atanh.gs.test.ts +47 -0
  260. package/gs/math/atanh.gs.ts +21 -0
  261. package/gs/math/bits.gs.test.ts +88 -0
  262. package/gs/math/bits.gs.ts +61 -0
  263. package/gs/math/cbrt.gs.test.ts +57 -0
  264. package/gs/math/cbrt.gs.ts +20 -0
  265. package/gs/math/const.gs.test.ts +54 -0
  266. package/gs/math/const.gs.ts +93 -0
  267. package/gs/math/copysign.gs.test.ts +44 -0
  268. package/gs/math/copysign.gs.ts +27 -0
  269. package/gs/math/dim.gs.test.ts +102 -0
  270. package/gs/math/dim.gs.ts +84 -0
  271. package/gs/math/erf.gs.test.ts +92 -0
  272. package/gs/math/erf.gs.ts +409 -0
  273. package/gs/math/erfinv.gs.test.ts +104 -0
  274. package/gs/math/erfinv.gs.ts +169 -0
  275. package/gs/math/exp.gs.test.ts +82 -0
  276. package/gs/math/exp.gs.ts +39 -0
  277. package/gs/math/expm1.gs.test.ts +48 -0
  278. package/gs/math/expm1.gs.ts +23 -0
  279. package/gs/math/floor.gs.test.ts +146 -0
  280. package/gs/math/floor.gs.ts +88 -0
  281. package/gs/math/fma.gs.test.ts +83 -0
  282. package/gs/math/fma.gs.ts +7 -0
  283. package/gs/math/frexp.gs.test.ts +146 -0
  284. package/gs/math/frexp.gs.ts +37 -0
  285. package/gs/math/gamma.gs.test.ts +66 -0
  286. package/gs/math/gamma.gs.ts +158 -0
  287. package/gs/math/hypot.gs.test.ts +73 -0
  288. package/gs/math/hypot.gs.ts +23 -0
  289. package/gs/math/index.ts +44 -0
  290. package/gs/math/j0.gs.test.ts +74 -0
  291. package/gs/math/j0.gs.ts +257 -0
  292. package/gs/math/j1.gs.test.ts +81 -0
  293. package/gs/math/j1.gs.ts +231 -0
  294. package/gs/math/jn.gs.test.ts +133 -0
  295. package/gs/math/jn.gs.ts +447 -0
  296. package/gs/math/ldexp.gs.test.ts +128 -0
  297. package/gs/math/ldexp.gs.ts +28 -0
  298. package/gs/math/lgamma.gs.test.ts +102 -0
  299. package/gs/math/lgamma.gs.ts +251 -0
  300. package/gs/math/log.gs.test.ts +40 -0
  301. package/gs/math/log.gs.ts +21 -0
  302. package/gs/math/log10.gs.test.ts +80 -0
  303. package/gs/math/log10.gs.ts +25 -0
  304. package/gs/math/log1p.gs.test.ts +55 -0
  305. package/gs/math/log1p.gs.ts +24 -0
  306. package/gs/math/logb.gs.test.ts +87 -0
  307. package/gs/math/logb.gs.ts +54 -0
  308. package/gs/math/mod.gs.test.ts +64 -0
  309. package/gs/math/mod.gs.ts +36 -0
  310. package/gs/math/modf.gs.test.ts +80 -0
  311. package/gs/math/modf.gs.ts +32 -0
  312. package/gs/math/nextafter.gs.test.ts +107 -0
  313. package/gs/math/nextafter.gs.ts +71 -0
  314. package/gs/math/pow.gs.test.ts +103 -0
  315. package/gs/math/pow.gs.ts +55 -0
  316. package/gs/math/pow10.gs.test.ts +58 -0
  317. package/gs/math/pow10.gs.ts +19 -0
  318. package/gs/math/remainder.gs.test.ts +70 -0
  319. package/gs/math/remainder.gs.ts +33 -0
  320. package/gs/math/signbit.gs.test.ts +33 -0
  321. package/gs/math/signbit.gs.ts +8 -0
  322. package/gs/math/sin.gs.test.ts +83 -0
  323. package/gs/math/sin.gs.ts +38 -0
  324. package/gs/math/sincos.gs.test.ts +91 -0
  325. package/gs/math/sincos.gs.ts +15 -0
  326. package/gs/math/sinh.gs.test.ts +66 -0
  327. package/gs/math/sinh.gs.ts +34 -0
  328. package/gs/math/sqrt.gs.test.ts +49 -0
  329. package/gs/math/sqrt.gs.ts +20 -0
  330. package/gs/math/tan.gs.test.ts +50 -0
  331. package/gs/math/tan.gs.ts +23 -0
  332. package/gs/math/tanh.gs.test.ts +52 -0
  333. package/gs/math/tanh.gs.ts +23 -0
  334. package/gs/math/trig_reduce.gs.ts +66 -0
  335. package/gs/math/unsafe.gs.ts +52 -0
  336. package/gs/strconv/atob.gs.ts +45 -0
  337. package/gs/strconv/atof.gs.ts +60 -0
  338. package/gs/strconv/atoi.gs.ts +243 -0
  339. package/gs/strconv/doc.gs.ts +2 -0
  340. package/gs/strconv/ftoa.gs.ts +66 -0
  341. package/gs/strconv/index.ts +6 -0
  342. package/gs/strconv/itoa.gs.ts +41 -0
  343. package/gs/strconv/quote.gs.ts +245 -0
  344. package/gs/strings/index.ts +4 -0
  345. package/gs/strings/replace.ts +9 -237
  346. package/gs/strings/search.ts +0 -28
  347. package/gs/sync/atomic/doc.gs.ts +276 -0
  348. package/gs/sync/atomic/doc_64.gs.ts +168 -0
  349. package/gs/sync/atomic/index.ts +4 -0
  350. package/gs/sync/atomic/type.gs.ts +596 -0
  351. package/gs/sync/atomic/value.gs.ts +158 -0
  352. package/gs/unsafe/unsafe.ts +6 -0
  353. package/package.json +1 -1
  354. package/gs/maps/iter.gs.ts +0 -71
  355. package/gs/maps/maps.gs.ts +0 -87
  356. package/gs/stringslite/godoc.txt +0 -17
  357. package/gs/stringslite/index.ts +0 -1
  358. package/gs/stringslite/strings.ts +0 -82
package/compiler/lit.go CHANGED
@@ -4,7 +4,9 @@ import (
4
4
  "fmt"
5
5
  "go/ast"
6
6
  "go/token"
7
+ "regexp"
7
8
  "strconv"
9
+ "strings"
8
10
  )
9
11
 
10
12
  // WriteBasicLit translates a Go basic literal (`ast.BasicLit`) into its
@@ -15,6 +17,8 @@ import (
15
17
  // `exp.Value` string, which typically corresponds to valid TypeScript syntax
16
18
  // (e.g., `123`, `3.14`, `"hello"`). Imaginary literals might need special
17
19
  // handling if they are to be fully supported beyond direct string output.
20
+ // - Legacy octal literals (e.g., `0777`) are converted to modern TypeScript
21
+ // octal syntax (e.g., `0o777`) to avoid ES module compatibility issues.
18
22
  func (c *GoToTSCompiler) WriteBasicLit(exp *ast.BasicLit) {
19
23
  if exp.Kind == token.CHAR {
20
24
  // Go char literal 'x' is a rune (int32). Translate to its numeric code point.
@@ -26,8 +30,60 @@ func (c *GoToTSCompiler) WriteBasicLit(exp *ast.BasicLit) {
26
30
  } else {
27
31
  c.tsw.WriteLiterallyf("%d", val)
28
32
  }
33
+ } else if exp.Kind == token.INT {
34
+ // Handle integer literals, including legacy octal conversion
35
+ value := exp.Value
36
+
37
+ // Check for legacy octal literals (starts with 0, followed by octal digits, but not 0x, 0b, or 0o)
38
+ if len(value) > 1 && value[0] == '0' && value != "0" {
39
+ // Check if it's already modern syntax (0x, 0b, 0o) or just legacy octal
40
+ if len(value) > 2 && (value[1] == 'x' || value[1] == 'X' ||
41
+ value[1] == 'b' || value[1] == 'B' ||
42
+ value[1] == 'o' || value[1] == 'O') {
43
+ // Already modern syntax (hex, binary, or modern octal), write as-is
44
+ c.tsw.WriteLiterally(value)
45
+ } else {
46
+ // Check if all remaining characters are valid octal digits (0-7)
47
+ isLegacyOctal := true
48
+ for i := 1; i < len(value); i++ {
49
+ if value[i] < '0' || value[i] > '7' {
50
+ isLegacyOctal = false
51
+ break
52
+ }
53
+ }
54
+
55
+ if isLegacyOctal {
56
+ // Convert legacy octal 0777 to modern octal 0o777
57
+ c.tsw.WriteLiterallyf("0o%s", value[1:])
58
+ } else {
59
+ // Not a valid octal, write as-is (might be decimal with leading zero)
60
+ c.tsw.WriteLiterally(value)
61
+ }
62
+ }
63
+ } else {
64
+ // Regular decimal integer or single zero, write as-is
65
+ c.tsw.WriteLiterally(value)
66
+ }
67
+ } else if exp.Kind == token.STRING {
68
+ // Handle string literals, with special processing for raw strings
69
+ value := exp.Value
70
+
71
+ // Check if this is a raw string literal (starts and ends with backticks)
72
+ if len(value) >= 2 && value[0] == '`' && value[len(value)-1] == '`' {
73
+ // This is a Go raw string - need to escape invalid \x sequences for JavaScript
74
+ content := value[1 : len(value)-1] // Remove surrounding backticks
75
+
76
+ // Escape invalid \x, \u, and \U sequences that would cause TS1125 errors
77
+ content = c.escapeInvalidEscapeSequences(content)
78
+
79
+ // Write as template literal with corrected content
80
+ c.tsw.WriteLiterallyf("`%s`", content)
81
+ } else {
82
+ // Regular string literal (double quotes) - write as-is
83
+ c.tsw.WriteLiterally(value)
84
+ }
29
85
  } else {
30
- // Other literals (INT, FLOAT, STRING, IMAG)
86
+ // Other literals (FLOAT, IMAG)
31
87
  c.tsw.WriteLiterally(exp.Value)
32
88
  }
33
89
  }
@@ -108,7 +164,7 @@ func (c *GoToTSCompiler) WriteFuncLitValue(exp *ast.FuncLit) error {
108
164
  // Declare named return variables and initialize them to their zero values
109
165
  for _, field := range exp.Type.Results.List {
110
166
  for _, name := range field.Names {
111
- c.tsw.WriteLiterallyf("let %s: ", name.Name)
167
+ c.tsw.WriteLiterallyf("let %s: ", c.sanitizeIdentifier(name.Name))
112
168
  c.WriteTypeExpr(field.Type)
113
169
  c.tsw.WriteLiterally(" = ")
114
170
  c.WriteZeroValueForType(c.pkg.TypesInfo.TypeOf(field.Type))
@@ -129,3 +185,56 @@ func (c *GoToTSCompiler) WriteFuncLitValue(exp *ast.FuncLit) error {
129
185
 
130
186
  return nil
131
187
  }
188
+
189
+ // escapeInvalidEscapeSequences escapes \x, \u, and \U sequences in raw strings that would be invalid in JavaScript template literals.
190
+ // JavaScript template literals expect:
191
+ // - \x to be followed by exactly 2 hexadecimal digits
192
+ // - \u to be followed by exactly 4 hexadecimal digits
193
+ // - \U to be followed by exactly 8 hexadecimal digits
194
+ // This function escapes sequences that don't meet these requirements.
195
+ func (c *GoToTSCompiler) escapeInvalidEscapeSequences(content string) string {
196
+ // Use regex to find all \x, \u, and \U sequences
197
+ re := regexp.MustCompile(`\\([xuU])([0-9a-fA-F]*)`)
198
+
199
+ return re.ReplaceAllStringFunc(content, func(match string) string {
200
+ if len(match) < 2 {
201
+ return match
202
+ }
203
+
204
+ escapeType := match[1] // x, u, or U
205
+ suffix := match[2:] // The hex digits that follow
206
+
207
+ var expectedLength int
208
+ switch escapeType {
209
+ case 'x':
210
+ expectedLength = 2
211
+ case 'u':
212
+ expectedLength = 4
213
+ case 'U':
214
+ expectedLength = 8
215
+ default:
216
+ return match
217
+ }
218
+
219
+ // Check if it has exactly the expected number of hex digits
220
+ if len(suffix) == expectedLength {
221
+ // Check if all characters are hex digits
222
+ isValidHex := true
223
+ for _, char := range suffix {
224
+ if !((char >= '0' && char <= '9') ||
225
+ (char >= 'a' && char <= 'f') ||
226
+ (char >= 'A' && char <= 'F')) {
227
+ isValidHex = false
228
+ break
229
+ }
230
+ }
231
+ if isValidHex {
232
+ // Valid escape sequence, keep as-is
233
+ return match
234
+ }
235
+ }
236
+
237
+ // Invalid escape sequence, escape the backslash
238
+ return strings.Replace(match, `\`, `\\`, 1)
239
+ })
240
+ }
@@ -100,12 +100,12 @@ var tokenMap = map[token.Token]string{
100
100
  token.QUO_ASSIGN: "/=",
101
101
  token.REM_ASSIGN: "%=",
102
102
 
103
- token.AND_ASSIGN: "&=",
104
- token.OR_ASSIGN: "|=",
105
- token.XOR_ASSIGN: "^=", // TODO: check if this works
106
- token.SHL_ASSIGN: "<<=",
107
- token.SHR_ASSIGN: ">>=",
108
- token.AND_NOT_ASSIGN: "&^=",
103
+ token.AND_ASSIGN: "&=",
104
+ token.OR_ASSIGN: "|=",
105
+ token.XOR_ASSIGN: "^=", // TODO: check if this works
106
+ token.SHL_ASSIGN: "<<=",
107
+ token.SHR_ASSIGN: ">>=",
108
+ // token.AND_NOT_ASSIGN: "&^=", // Handled specially in assignment logic
109
109
 
110
110
  token.LAND: "&&",
111
111
  token.LOR: "||",
@@ -61,11 +61,6 @@ func isProtobufGoLitePackage(pkgPath string) bool {
61
61
  if strings.HasPrefix(pkgPath, "github.com/aperturerobotics/json-iterator-lite") {
62
62
  return true
63
63
  }
64
- // Skip other packages commonly used only by .pb.go files
65
- switch pkgPath {
66
- case "encoding/json", "encoding/base64", "strconv", "fmt":
67
- return true
68
- }
69
64
  return false
70
65
  }
71
66
 
@@ -0,0 +1,101 @@
1
+ package compiler
2
+
3
+ // sanitizeIdentifier checks if an identifier is a JavaScript/TypeScript reserved word
4
+ // or conflicts with built-in types, and transforms it if needed. This prevents
5
+ // compilation errors when Go identifiers conflict with JS/TS keywords or built-ins.
6
+ func sanitizeIdentifier(name string) string {
7
+ // Don't sanitize boolean literals - they are valid in both Go and JS/TS
8
+ if name == "true" || name == "false" {
9
+ return name
10
+ }
11
+
12
+ // Handle TypeScript built-in types that conflict with Go type parameter names
13
+ builtinTypes := map[string]string{
14
+ "Map": "MapType",
15
+ // Add other built-in types as needed
16
+ }
17
+
18
+ if replacement, exists := builtinTypes[name]; exists {
19
+ return replacement
20
+ }
21
+
22
+ // List of JavaScript/TypeScript reserved words that could conflict
23
+ reservedWords := map[string]bool{
24
+ "abstract": true,
25
+ "any": true,
26
+ "as": true,
27
+ "asserts": true,
28
+ "async": true,
29
+ "await": true,
30
+ "boolean": true,
31
+ "break": true,
32
+ "case": true,
33
+ "catch": true,
34
+ "class": true,
35
+ "const": true,
36
+ "constructor": true,
37
+ "continue": true,
38
+ "debugger": true,
39
+ "declare": true,
40
+ "default": true,
41
+ "delete": true,
42
+ "do": true,
43
+ "else": true,
44
+ "enum": true,
45
+ "export": true,
46
+ "extends": true,
47
+ "finally": true,
48
+ "for": true,
49
+ "from": true,
50
+ "function": true,
51
+ "get": true,
52
+ "if": true,
53
+ "implements": true,
54
+ "import": true,
55
+ "in": true,
56
+ "instanceof": true,
57
+ "interface": true,
58
+ "is": true,
59
+ "keyof": true,
60
+ "let": true,
61
+ "module": true,
62
+ "namespace": true,
63
+ "never": true,
64
+ "new": true,
65
+ "null": true,
66
+ "number": true,
67
+ "object": true,
68
+ "of": true,
69
+ "package": true,
70
+ "private": true,
71
+ "protected": true,
72
+ "public": true,
73
+ "readonly": true,
74
+ "require": true,
75
+ "return": true,
76
+ "set": true,
77
+ "static": true,
78
+ "string": true,
79
+ "super": true,
80
+ "switch": true,
81
+ "symbol": true,
82
+ "this": true,
83
+ "throw": true,
84
+ "try": true,
85
+ "type": true,
86
+ "typeof": true,
87
+ "undefined": true,
88
+ "unique": true,
89
+ "unknown": true,
90
+ "var": true,
91
+ "void": true,
92
+ "while": true,
93
+ "with": true,
94
+ "yield": true,
95
+ }
96
+
97
+ if reservedWords[name] {
98
+ return "_" + name
99
+ }
100
+ return name
101
+ }
@@ -56,6 +56,10 @@ func (c *GoToTSCompiler) WriteStructTypeSpec(a *ast.TypeSpec, t *ast.StructType)
56
56
  }
57
57
  for _, name := range field.Names {
58
58
  fieldName := name.Name
59
+ // Skip underscore fields
60
+ if fieldName == "_" {
61
+ continue
62
+ }
59
63
  fieldType := c.pkg.TypesInfo.TypeOf(field.Type)
60
64
  if fieldType == nil {
61
65
  fieldType = types.Typ[types.Invalid]
@@ -86,6 +90,10 @@ func (c *GoToTSCompiler) WriteStructTypeSpec(a *ast.TypeSpec, t *ast.StructType)
86
90
  } else {
87
91
  fieldKeyName = field.Name()
88
92
  }
93
+ // Skip underscore fields
94
+ if fieldKeyName == "_" {
95
+ continue
96
+ }
89
97
  fieldTsType := c.getTypeString(field.Type())
90
98
  c.tsw.WriteLinef("%s: $.VarRef<%s>;", fieldKeyName, fieldTsType)
91
99
  }
@@ -105,6 +113,7 @@ func (c *GoToTSCompiler) WriteStructTypeSpec(a *ast.TypeSpec, t *ast.StructType)
105
113
  c.tsw.WriteLine("")
106
114
  c.tsw.Indent(1)
107
115
 
116
+ firstFieldWritten := false
108
117
  for i := range numFields {
109
118
  field := underlyingStruct.Field(i)
110
119
  fieldType := field.Type()
@@ -115,13 +124,20 @@ func (c *GoToTSCompiler) WriteStructTypeSpec(a *ast.TypeSpec, t *ast.StructType)
115
124
  fieldKeyName = field.Name()
116
125
  }
117
126
 
118
- c.writeVarRefedFieldInitializer(fieldKeyName, fieldType, field.Anonymous())
127
+ // Skip underscore fields
128
+ if fieldKeyName == "_" {
129
+ continue
130
+ }
119
131
 
120
- if i < numFields-1 {
132
+ if firstFieldWritten {
121
133
  c.tsw.WriteLine(",")
122
- } else {
123
- c.tsw.WriteLine("")
124
134
  }
135
+
136
+ c.writeVarRefedFieldInitializer(fieldKeyName, fieldType, field.Anonymous())
137
+ firstFieldWritten = true
138
+ }
139
+ if firstFieldWritten {
140
+ c.tsw.WriteLine("")
125
141
  }
126
142
  c.tsw.Indent(-1)
127
143
  }
@@ -154,6 +170,7 @@ func (c *GoToTSCompiler) WriteStructTypeSpec(a *ast.TypeSpec, t *ast.StructType)
154
170
  c.tsw.WriteLine("cloned._fields = {")
155
171
  c.tsw.Indent(1)
156
172
 
173
+ firstFieldWritten := false
157
174
  for i := range numFields {
158
175
  field := underlyingStruct.Field(i)
159
176
  fieldType := field.Type()
@@ -164,13 +181,20 @@ func (c *GoToTSCompiler) WriteStructTypeSpec(a *ast.TypeSpec, t *ast.StructType)
164
181
  fieldKeyName = field.Name()
165
182
  }
166
183
 
167
- c.writeClonedFieldInitializer(fieldKeyName, fieldType, field.Anonymous())
184
+ // Skip underscore fields
185
+ if fieldKeyName == "_" {
186
+ continue
187
+ }
168
188
 
169
- if i < numFields-1 {
189
+ if firstFieldWritten {
170
190
  c.tsw.WriteLine(",")
171
- } else {
172
- c.tsw.WriteLine("")
173
191
  }
192
+
193
+ c.writeClonedFieldInitializer(fieldKeyName, fieldType, field.Anonymous())
194
+ firstFieldWritten = true
195
+ }
196
+ if firstFieldWritten {
197
+ c.tsw.WriteLine("")
174
198
  }
175
199
 
176
200
  c.tsw.Indent(-1)
@@ -402,6 +426,10 @@ func (c *GoToTSCompiler) WriteStructTypeSpec(a *ast.TypeSpec, t *ast.StructType)
402
426
  } else {
403
427
  fieldKeyName = field.Name()
404
428
  }
429
+ // Skip underscore fields
430
+ if fieldKeyName == "_" {
431
+ continue
432
+ }
405
433
  // fieldTsType := c.getTypeString(field.Type())
406
434
  if !firstField {
407
435
  c.tsw.WriteLiterally(", ")
@@ -451,6 +479,11 @@ func (c *GoToTSCompiler) generateFlattenedInitTypeString(structType *types.Named
451
479
  field := underlying.Field(i)
452
480
  fieldName := field.Name()
453
481
 
482
+ // Skip underscore fields
483
+ if fieldName == "_" {
484
+ continue
485
+ }
486
+
454
487
  if !field.Exported() && field.Pkg() != c.pkg.Types {
455
488
  continue
456
489
  }
@@ -41,6 +41,10 @@ func (c *GoToTSCompiler) WriteValueSpec(a *ast.ValueSpec) error {
41
41
  // Handle single variable declaration
42
42
  if len(a.Names) == 1 {
43
43
  name := a.Names[0]
44
+ // Skip underscore variables
45
+ if name.Name == "_" {
46
+ return nil
47
+ }
44
48
  obj := c.pkg.TypesInfo.Defs[name]
45
49
  if obj == nil {
46
50
  return fmt.Errorf("could not resolve type: %v", name)
@@ -91,7 +95,7 @@ func (c *GoToTSCompiler) WriteValueSpec(a *ast.ValueSpec) error {
91
95
  c.tsw.WriteLiterally("export ")
92
96
  }
93
97
  c.tsw.WriteLiterally("let ")
94
- c.tsw.WriteLiterally(name.Name)
98
+ c.tsw.WriteLiterally(c.sanitizeIdentifier(name.Name))
95
99
 
96
100
  // Write type annotation if:
97
101
  // 1. Not a slice conversion (normal case), OR
@@ -193,27 +197,34 @@ func (c *GoToTSCompiler) WriteValueSpec(a *ast.ValueSpec) error {
193
197
  if hasInitializer {
194
198
  // Handle &v initializer specifically for unvarrefed variables
195
199
  if unaryExpr, isUnary := initializerExpr.(*ast.UnaryExpr); isUnary && unaryExpr.Op == token.AND {
196
- // Initializer is &v
197
- // Check if v is varrefed
198
- needsVarRefOperand := false
199
- unaryExprXIdent, ok := unaryExpr.X.(*ast.Ident)
200
- if ok {
200
+ // Initializer is &expr
201
+ // Check if expr is an identifier (variable) or something else (e.g., composite literal)
202
+ if unaryExprXIdent, ok := unaryExpr.X.(*ast.Ident); ok {
203
+ // Case: &variable
204
+ // Check if the variable is varrefed
201
205
  innerObj := c.pkg.TypesInfo.Uses[unaryExprXIdent]
202
- needsVarRefOperand = innerObj != nil && c.analysis.NeedsVarRef(innerObj)
203
- }
206
+ needsVarRefOperand := innerObj != nil && c.analysis.NeedsVarRef(innerObj)
204
207
 
205
- // If v is varrefed, assign the varRef itself (v)
206
- // If v is not varrefed, assign $.varRef(v)
207
- if needsVarRefOperand {
208
- // do not write .value here.
209
- c.WriteIdent(unaryExprXIdent, false)
208
+ // If variable is varrefed, assign the varRef itself (variable)
209
+ // If variable is not varrefed, assign $.varRef(variable)
210
+ if needsVarRefOperand {
211
+ // do not write .value here.
212
+ c.WriteIdent(unaryExprXIdent, false)
213
+ } else {
214
+ // &unvarrefedVar -> $.varRef(unvarrefedVar)
215
+ c.tsw.WriteLiterally("$.varRef(")
216
+ if err := c.WriteValueExpr(unaryExpr.X); err != nil { // Write 'variable'
217
+ return err
218
+ }
219
+ c.tsw.WriteLiterally(")")
220
+ }
210
221
  } else {
211
- // &unvarrefedVar -> $.varRef(unvarrefedVar)
212
- c.tsw.WriteLiterally("$.varRef(")
213
- if err := c.WriteValueExpr(unaryExpr.X); err != nil { // Write 'v'
222
+ // Case: &compositeLiteral or &otherExpression
223
+ // For composite literals and other expressions, just write the expression directly
224
+ // Example: &MyStruct{} -> new MyStruct({})
225
+ if err := c.WriteValueExpr(unaryExpr.X); err != nil {
214
226
  return err
215
227
  }
216
- c.tsw.WriteLiterally(")")
217
228
  }
218
229
  } else {
219
230
  // Check if this is a named type with methods and the initializer is a basic value
@@ -315,7 +326,7 @@ func (c *GoToTSCompiler) WriteValueSpec(a *ast.ValueSpec) error {
315
326
  if i != 0 {
316
327
  c.tsw.WriteLiterally(", ")
317
328
  }
318
- c.tsw.WriteLiterally(name.Name)
329
+ c.tsw.WriteLiterally(c.sanitizeIdentifier(name.Name))
319
330
  // TODO: Add type annotations for multi-var declarations if possible/needed
320
331
  }
321
332
  c.tsw.WriteLiterally("]")
@@ -222,10 +222,25 @@ func (c *GoToTSCompiler) WriteStmtAssign(exp *ast.AssignStmt) error {
222
222
  }
223
223
 
224
224
  // For simple cases without selector expressions, use array destructuring
225
+ // Add semicolon before destructuring assignment to prevent TypeScript
226
+ // from interpreting it as array access on the previous line
227
+ if tok != token.DEFINE {
228
+ c.tsw.WriteLiterally(";")
229
+ }
225
230
  c.tsw.WriteLiterally("[")
226
231
 
232
+ // Find the last non-blank identifier to avoid trailing commas
233
+ lastNonBlankIndex := -1
234
+ for i := len(lhs) - 1; i >= 0; i-- {
235
+ if ident, ok := lhs[i].(*ast.Ident); !ok || ident.Name != "_" {
236
+ lastNonBlankIndex = i
237
+ break
238
+ }
239
+ }
240
+
227
241
  for i, lhsExpr := range lhs {
228
- if i != 0 {
242
+ // Write comma before non-first elements
243
+ if i > 0 {
229
244
  c.tsw.WriteLiterally(", ")
230
245
  }
231
246
 
@@ -234,6 +249,7 @@ func (c *GoToTSCompiler) WriteStmtAssign(exp *ast.AssignStmt) error {
234
249
  if ident.Name != "_" {
235
250
  c.WriteIdent(ident, false)
236
251
  }
252
+ // For blank identifiers, we write nothing (empty slot)
237
253
  } else if selectorExpr, ok := lhsExpr.(*ast.SelectorExpr); ok {
238
254
  // Handle selector expressions (e.g., a.b) by using WriteValueExpr
239
255
  if err := c.WriteValueExpr(selectorExpr); err != nil {
@@ -263,6 +279,11 @@ func (c *GoToTSCompiler) WriteStmtAssign(exp *ast.AssignStmt) error {
263
279
  // Should not happen for valid Go code in this context, but handle defensively
264
280
  return errors.Errorf("unhandled LHS expression in destructuring: %T", lhsExpr)
265
281
  }
282
+
283
+ // Stop writing if we've reached the last non-blank element
284
+ if i == lastNonBlankIndex {
285
+ break
286
+ }
266
287
  }
267
288
  c.tsw.WriteLiterally("] = ")
268
289
 
package/compiler/stmt.go CHANGED
@@ -520,13 +520,17 @@ func (c *GoToTSCompiler) WriteStmtReturn(exp *ast.ReturnStmt) error {
520
520
  }
521
521
  }
522
522
 
523
- if len(namedReturns) > 0 {
523
+ if len(namedReturns) == 1 {
524
+ // Single named return - don't wrap in array
525
+ c.tsw.WriteLiterally(c.sanitizeIdentifier(namedReturns[0]))
526
+ } else if len(namedReturns) > 1 {
527
+ // Multiple named returns - wrap in array
524
528
  c.tsw.WriteLiterally("[")
525
529
  for i, name := range namedReturns {
526
530
  if i != 0 {
527
531
  c.tsw.WriteLiterally(", ")
528
532
  }
529
- c.tsw.WriteLiterally(name)
533
+ c.tsw.WriteLiterally(c.sanitizeIdentifier(name))
530
534
  }
531
535
  c.tsw.WriteLiterally("]")
532
536
  }
@@ -849,15 +853,28 @@ func (c *GoToTSCompiler) WriteStmtDefer(exp *ast.DeferStmt) error {
849
853
  }
850
854
 
851
855
  // WriteStmtLabeled handles labeled statements (ast.LabeledStmt), such as "label: statement".
852
- // In TypeScript, this translates to "label: statement" directly.
856
+ // In TypeScript, labels cannot be used with variable declarations, so we need to handle this case specially.
853
857
  func (c *GoToTSCompiler) WriteStmtLabeled(stmt *ast.LabeledStmt) error {
854
- // Write the label name followed by a colon
855
- c.tsw.WriteLiterally(stmt.Label.Name)
856
- c.tsw.WriteLiterally(": ")
858
+ // Check if the labeled statement is a declaration statement
859
+ if declStmt, ok := stmt.Stmt.(*ast.DeclStmt); ok {
860
+ // For declaration statements, we need to put the label on a separate line
861
+ // because TypeScript doesn't allow labels with declarations
862
+ c.tsw.WriteLiterally(stmt.Label.Name)
863
+ c.tsw.WriteLine(": {}")
857
864
 
858
- // Write the labeled statement
859
- if err := c.WriteStmt(stmt.Stmt); err != nil {
860
- return fmt.Errorf("failed to write labeled statement: %w", err)
865
+ // Write the declaration statement without the label
866
+ if err := c.WriteStmt(declStmt); err != nil {
867
+ return fmt.Errorf("failed to write labeled declaration statement: %w", err)
868
+ }
869
+ } else {
870
+ // For non-declaration statements, write the label normally
871
+ c.tsw.WriteLiterally(stmt.Label.Name)
872
+ c.tsw.WriteLiterally(": ")
873
+
874
+ // Write the labeled statement
875
+ if err := c.WriteStmt(stmt.Stmt); err != nil {
876
+ return fmt.Errorf("failed to write labeled statement: %w", err)
877
+ }
861
878
  }
862
879
 
863
880
  return nil
package/compiler/type.go CHANGED
@@ -369,12 +369,12 @@ func (c *GoToTSCompiler) WriteFuncType(exp *ast.FuncType, isAsync bool) {
369
369
  if isAsync {
370
370
  c.tsw.WriteLiterally("Promise<")
371
371
  }
372
- if len(exp.Results.List) == 1 && len(exp.Results.List[0].Names) == 0 {
373
- // Single unnamed return type
372
+ if len(exp.Results.List) == 1 {
373
+ // Single return type (named or unnamed)
374
374
  typ := c.pkg.TypesInfo.TypeOf(exp.Results.List[0].Type)
375
375
  c.WriteGoType(typ, GoTypeContextFunctionReturn)
376
376
  } else {
377
- // Multiple or named return types -> tuple
377
+ // Multiple return types -> tuple
378
378
  c.tsw.WriteLiterally("[")
379
379
  for i, field := range exp.Results.List {
380
380
  if i > 0 {
@@ -5,7 +5,8 @@ export * from './io.js';
5
5
  export * from './map.js';
6
6
  export * from './slice.js';
7
7
  export * from './type.js';
8
- export type Bytes = Uint8Array | import('./slice.js').Slice<number>;
8
+ import type { Slice } from './slice.js';
9
+ export type Bytes = Uint8Array | Slice<number>;
9
10
  export declare function int(value: number): number;
10
11
  export declare function copy<T>(dst: T[] | Uint8Array, src: T[] | Uint8Array | string): number;
11
12
  export declare function multiplyDuration(duration: any, multiplier: number): any;
@@ -32,4 +33,4 @@ export declare function normalizeBytes(bytes: Uint8Array | number[] | null | und
32
33
  * Handles all slice types including null, arrays, Uint8Array, and SliceProxy.
33
34
  * @param s The slice to sort in place
34
35
  */
35
- export declare function sortSlice<T extends string | number>(s: import('./slice.js').Slice<T>): void;
36
+ export declare function sortSlice<T extends string | number>(s: Slice<T>): void;
@@ -5,6 +5,7 @@ export * from './io.js';
5
5
  export * from './map.js';
6
6
  export * from './slice.js';
7
7
  export * from './type.js';
8
+ import { isSliceProxy } from './slice.js';
8
9
  // int converts a value to a Go int type, handling proper signed integer conversion
9
10
  // This ensures that values like 2147483648 (2^31) are properly handled according to Go semantics
10
11
  export function int(value) {
@@ -152,7 +153,7 @@ export function sortSlice(s) {
152
153
  return;
153
154
  }
154
155
  // Handle SliceProxy case - sort the backing array in-place within the slice bounds
155
- if (s && typeof s === 'object' && '__meta__' in s) {
156
+ if (isSliceProxy(s)) {
156
157
  const proxy = s;
157
158
  const meta = proxy.__meta__;
158
159
  const section = meta.backing.slice(meta.offset, meta.offset + meta.length);
@@ -1 +1 @@
1
- {"version":3,"file":"builtin.js","sourceRoot":"","sources":["../../../gs/builtin/builtin.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AAMzB,mFAAmF;AACnF,iGAAiG;AACjG,MAAM,UAAU,GAAG,CAAC,KAAa;IAC/B,0FAA0F;IAC1F,wFAAwF;IACxF,6FAA6F;IAC7F,kDAAkD;IAElD,yEAAyE;IACzE,uFAAuF;IACvF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,oFAAoF;AACpF,4CAA4C;AAC5C,MAAM,UAAU,IAAI,CAClB,GAAqB,EACrB,GAA8B;IAE9B,kDAAkD;IAClD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,YAAY,UAAU,EAAE,CAAC;QACzD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;QACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;QAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;QACtB,CAAC;QACD,OAAO,CAAC,CAAA;IACV,CAAC;IAED,uCAAuC;IACvC,IAAI,GAAG,YAAY,UAAU,IAAI,GAAG,YAAY,UAAU,EAAE,CAAC;QAC3D,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC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