goscript 0.0.30 → 0.0.32

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 (106) hide show
  1. package/compiler/expr-call.go +54 -0
  2. package/compiler/index.ts +1 -1
  3. package/compiler/stmt-assign.go +14 -0
  4. package/dist/compiler/index.js +1 -1
  5. package/dist/compiler/index.js.map +1 -1
  6. package/dist/gs/builtin/channel.d.ts +6 -6
  7. package/dist/gs/builtin/channel.js +3 -3
  8. package/dist/gs/builtin/channel.js.map +1 -1
  9. package/dist/gs/builtin/slice.js +3 -9
  10. package/dist/gs/builtin/slice.js.map +1 -1
  11. package/dist/gs/context/context.js +2 -2
  12. package/dist/gs/context/context.js.map +1 -1
  13. package/dist/gs/internal/oserror/errors.d.ts +1 -1
  14. package/dist/gs/internal/oserror/errors.js +6 -6
  15. package/dist/gs/internal/oserror/index.d.ts +1 -1
  16. package/dist/gs/internal/oserror/index.js +1 -1
  17. package/dist/gs/internal/oserror/index.js.map +1 -1
  18. package/dist/gs/io/fs/format.d.ts +1 -1
  19. package/dist/gs/io/fs/format.js +12 -12
  20. package/dist/gs/io/fs/format.js.map +1 -1
  21. package/dist/gs/io/fs/fs.d.ts +2 -2
  22. package/dist/gs/io/fs/fs.js +258 -36
  23. package/dist/gs/io/fs/fs.js.map +1 -1
  24. package/dist/gs/io/fs/glob.d.ts +2 -2
  25. package/dist/gs/io/fs/glob.js +40 -14
  26. package/dist/gs/io/fs/glob.js.map +1 -1
  27. package/dist/gs/io/fs/index.d.ts +8 -8
  28. package/dist/gs/io/fs/index.js +8 -8
  29. package/dist/gs/io/fs/readdir.d.ts +2 -2
  30. package/dist/gs/io/fs/readdir.js +78 -9
  31. package/dist/gs/io/fs/readdir.js.map +1 -1
  32. package/dist/gs/io/fs/readfile.d.ts +2 -2
  33. package/dist/gs/io/fs/readfile.js +31 -13
  34. package/dist/gs/io/fs/readfile.js.map +1 -1
  35. package/dist/gs/io/fs/stat.d.ts +2 -2
  36. package/dist/gs/io/fs/stat.js +25 -2
  37. package/dist/gs/io/fs/stat.js.map +1 -1
  38. package/dist/gs/io/fs/sub.d.ts +2 -2
  39. package/dist/gs/io/fs/sub.js +264 -28
  40. package/dist/gs/io/fs/sub.js.map +1 -1
  41. package/dist/gs/io/fs/walk.d.ts +2 -2
  42. package/dist/gs/io/fs/walk.js +7 -7
  43. package/dist/gs/io/fs/walk.js.map +1 -1
  44. package/dist/gs/iter/iter.js +1 -1
  45. package/dist/gs/iter/iter.js.map +1 -1
  46. package/dist/gs/path/index.d.ts +2 -2
  47. package/dist/gs/path/index.js +2 -2
  48. package/dist/gs/path/match.d.ts +1 -1
  49. package/dist/gs/path/match.js +39 -33
  50. package/dist/gs/path/match.js.map +1 -1
  51. package/dist/gs/path/path.js +53 -24
  52. package/dist/gs/path/path.js.map +1 -1
  53. package/dist/gs/runtime/runtime.d.ts +3 -3
  54. package/dist/gs/runtime/runtime.js +3 -3
  55. package/dist/gs/runtime/runtime.js.map +1 -1
  56. package/dist/gs/strings/builder.d.ts +1 -1
  57. package/dist/gs/strings/builder.js +1 -1
  58. package/dist/gs/strings/builder.js.map +1 -1
  59. package/dist/gs/strings/clone.js.map +1 -1
  60. package/dist/gs/strings/compare.js.map +1 -1
  61. package/dist/gs/strings/replace.js +4 -2
  62. package/dist/gs/strings/replace.js.map +1 -1
  63. package/dist/gs/strings/strings.js +0 -12
  64. package/dist/gs/strings/strings.js.map +1 -1
  65. package/dist/gs/sync/sync.d.ts +5 -5
  66. package/dist/gs/sync/sync.js +5 -5
  67. package/dist/gs/sync/sync.js.map +1 -1
  68. package/dist/gs/time/time.d.ts +2 -2
  69. package/dist/gs/time/time.js +62 -16
  70. package/dist/gs/time/time.js.map +1 -1
  71. package/dist/gs/unsafe/unsafe.d.ts +8 -8
  72. package/dist/gs/unsafe/unsafe.js +8 -8
  73. package/dist/gs/unsafe/unsafe.js.map +1 -1
  74. package/gs/builtin/builtin.ts +1 -1
  75. package/gs/builtin/channel.ts +6 -6
  76. package/gs/builtin/slice.ts +3 -9
  77. package/gs/context/context.ts +2 -2
  78. package/gs/internal/oserror/errors.ts +7 -8
  79. package/gs/internal/oserror/index.ts +7 -1
  80. package/gs/io/fs/format.ts +39 -40
  81. package/gs/io/fs/fs.ts +446 -222
  82. package/gs/io/fs/glob.ts +164 -131
  83. package/gs/io/fs/index.ts +8 -8
  84. package/gs/io/fs/readdir.ts +188 -106
  85. package/gs/io/fs/readfile.ts +79 -58
  86. package/gs/io/fs/stat.ts +49 -25
  87. package/gs/io/fs/sub.ts +422 -181
  88. package/gs/io/fs/walk.ts +67 -63
  89. package/gs/iter/iter.ts +1 -1
  90. package/gs/path/index.ts +2 -2
  91. package/gs/path/match.ts +263 -250
  92. package/gs/path/path.ts +259 -232
  93. package/gs/runtime/runtime.ts +4 -4
  94. package/gs/strings/builder.test.ts +0 -1
  95. package/gs/strings/builder.ts +1 -1
  96. package/gs/strings/clone.ts +0 -2
  97. package/gs/strings/compare.ts +0 -2
  98. package/gs/strings/iter.test.ts +0 -1
  99. package/gs/strings/replace.test.ts +3 -4
  100. package/gs/strings/replace.ts +4 -7
  101. package/gs/strings/strings.test.ts +6 -6
  102. package/gs/strings/strings.ts +0 -14
  103. package/gs/sync/sync.ts +5 -5
  104. package/gs/time/time.ts +86 -29
  105. package/gs/unsafe/unsafe.ts +8 -8
  106. package/package.json +1 -1
@@ -91,7 +91,7 @@ describe('strings', () => {
91
91
  it('should check if any rune satisfies predicate', () => {
92
92
  expect(ContainsFunc('hello', (r) => r === 101)).toBe(true) // 'e'
93
93
  expect(ContainsFunc('hello', (r) => r === 120)).toBe(false) // 'x'
94
- expect(ContainsFunc('', (r) => true)).toBe(false)
94
+ expect(ContainsFunc('', () => true)).toBe(false)
95
95
  expect(ContainsFunc('abc', null)).toBe(false)
96
96
  })
97
97
  })
@@ -171,7 +171,7 @@ describe('strings', () => {
171
171
  const result = FieldsFunc('a,b,c', (r) => r === 44) // comma
172
172
  expect($.asArray(result)).toEqual(['a', 'b', 'c'])
173
173
 
174
- const empty = FieldsFunc('', (r) => true)
174
+ const empty = FieldsFunc('', () => true)
175
175
  expect($.asArray(empty)).toEqual([])
176
176
 
177
177
  const noSplit = FieldsFunc('abc', null)
@@ -226,7 +226,7 @@ describe('strings', () => {
226
226
  it('should find first index where predicate is true', () => {
227
227
  expect(IndexFunc('hello', (r) => r === 101)).toBe(1) // 'e'
228
228
  expect(IndexFunc('hello', (r) => r === 120)).toBe(-1) // 'x'
229
- expect(IndexFunc('', (r) => true)).toBe(-1)
229
+ expect(IndexFunc('', () => true)).toBe(-1)
230
230
  expect(IndexFunc('abc', null)).toBe(-1)
231
231
  })
232
232
  })
@@ -280,7 +280,7 @@ describe('strings', () => {
280
280
  it('should find last index where predicate is true', () => {
281
281
  expect(LastIndexFunc('hello', (r) => r === 108)).toBe(3) // 'l'
282
282
  expect(LastIndexFunc('hello', (r) => r === 120)).toBe(-1) // 'x'
283
- expect(LastIndexFunc('', (r) => true)).toBe(-1)
283
+ expect(LastIndexFunc('', () => true)).toBe(-1)
284
284
  expect(LastIndexFunc('abc', null)).toBe(-1)
285
285
  })
286
286
  })
@@ -288,7 +288,7 @@ describe('strings', () => {
288
288
  describe('Map', () => {
289
289
  it('should apply mapping function to each rune', () => {
290
290
  expect(Map((r) => r + 1, 'abc')).toBe('bcd')
291
- expect(Map((r) => 65, 'hello')).toBe('AAAAA') // all to 'A'
291
+ expect(Map(() => 65, 'hello')).toBe('AAAAA') // all to 'A'
292
292
  expect(Map(null, 'hello')).toBe('hello')
293
293
  expect(Map((r) => r, '')).toBe('')
294
294
  })
@@ -413,7 +413,7 @@ describe('strings', () => {
413
413
  it('should trim runes satisfying predicate from both ends', () => {
414
414
  expect(TrimFunc(' hello ', (r) => r === 32)).toBe('hello') // space
415
415
  expect(TrimFunc('hello', (r) => r === 120)).toBe('hello') // 'x'
416
- expect(TrimFunc('', (r) => true)).toBe('')
416
+ expect(TrimFunc('', () => true)).toBe('')
417
417
  expect(TrimFunc('abc', null)).toBe('abc')
418
418
  })
419
419
  })
@@ -1,19 +1,5 @@
1
1
  import * as $ from '@goscript/builtin/builtin.js'
2
2
 
3
- // Helper function to convert string to runes (code points)
4
- function stringToRunes(s: string): number[] {
5
- const runes: number[] = []
6
- for (const char of s) {
7
- runes.push(char.codePointAt(0) || 0)
8
- }
9
- return runes
10
- }
11
-
12
- // Helper function to convert runes to string
13
- function runesToString(runes: number[]): string {
14
- return String.fromCodePoint(...runes)
15
- }
16
-
17
3
  // Count counts the number of non-overlapping instances of substr in s.
18
4
  // If substr is an empty string, Count returns 1 + the number of Unicode code points in s.
19
5
  export function Count(s: string, substr: string): number {
package/gs/sync/sync.ts CHANGED
@@ -14,7 +14,7 @@ export class Mutex implements Locker {
14
14
  private _locked: boolean = false
15
15
  private _waitQueue: Array<() => void> = []
16
16
 
17
- constructor(init?: Partial<{}>) {
17
+ constructor(_init?: Partial<{}>) {
18
18
  // Mutex has no public fields to initialize
19
19
  }
20
20
 
@@ -72,7 +72,7 @@ export class RWMutex {
72
72
  private _readerWaitQueue: Array<() => void> = []
73
73
  private _writerWaitQueue: Array<() => void> = []
74
74
 
75
- constructor(init?: Partial<{}>) {
75
+ constructor(_init?: Partial<{}>) {
76
76
  // RWMutex has no public fields to initialize
77
77
  }
78
78
 
@@ -169,7 +169,7 @@ export class WaitGroup {
169
169
  private _counter: number = 0
170
170
  private _waiters: Array<() => void> = []
171
171
 
172
- constructor(init?: Partial<{}>) {
172
+ constructor(_init?: Partial<{}>) {
173
173
  // WaitGroup has no public fields to initialize
174
174
  }
175
175
 
@@ -215,7 +215,7 @@ export class Once {
215
215
  private _done: boolean = false
216
216
  private _m: Mutex = new Mutex()
217
217
 
218
- constructor(init?: Partial<{}>) {
218
+ constructor(_init?: Partial<{}>) {
219
219
  // Once has no public fields to initialize
220
220
  }
221
221
 
@@ -295,7 +295,7 @@ export class Map {
295
295
  private _m: RWMutex = new RWMutex()
296
296
  private _data: globalThis.Map<any, any> = new globalThis.Map()
297
297
 
298
- constructor(init?: Partial<{}>) {
298
+ constructor(_init?: Partial<{}>) {
299
299
  // Map has no public fields to initialize
300
300
  }
301
301
 
package/gs/time/time.ts CHANGED
@@ -5,7 +5,12 @@ export class Time {
5
5
  private _monotonic?: number // high-resolution monotonic timestamp in nanoseconds
6
6
  private _location: Location // timezone location
7
7
 
8
- constructor(date: globalThis.Date, nsec: number = 0, monotonic?: number, location?: Location) {
8
+ constructor(
9
+ date: globalThis.Date,
10
+ nsec: number = 0,
11
+ monotonic?: number,
12
+ location?: Location,
13
+ ) {
9
14
  this._date = new globalThis.Date(date.getTime())
10
15
  this._nsec = nsec
11
16
  this._monotonic = monotonic
@@ -21,16 +26,16 @@ export class Time {
21
26
  public Format(layout: string): string {
22
27
  // Implementation of Go's time formatting based on reference time:
23
28
  // "Mon Jan 2 15:04:05 MST 2006" (Unix time 1136239445)
24
-
29
+
25
30
  // Calculate the time in the timezone of this Time object
26
31
  let year: number, month0: number, dayOfMonth: number, dayOfWeek: number
27
32
  let hour24: number, minute: number, second: number
28
-
33
+
29
34
  if (this._location.offsetSeconds !== undefined) {
30
35
  // For fixed timezone locations, adjust the UTC time by the offset
31
36
  const offsetMs = this._location.offsetSeconds * 1000
32
37
  const adjustedTime = new globalThis.Date(this._date.getTime() + offsetMs)
33
-
38
+
34
39
  year = adjustedTime.getUTCFullYear()
35
40
  month0 = adjustedTime.getUTCMonth() // 0-11 for array indexing
36
41
  dayOfMonth = adjustedTime.getUTCDate() // 1-31
@@ -48,13 +53,47 @@ export class Time {
48
53
  minute = this._date.getMinutes() // 0-59
49
54
  second = this._date.getSeconds() // 0-59
50
55
  }
51
-
56
+
52
57
  const nsec = this._nsec // Nanoseconds (0-999,999,999)
53
58
 
54
- const shortMonthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
55
- const longMonthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
56
- const shortDayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
57
- const longDayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
59
+ const shortMonthNames = [
60
+ 'Jan',
61
+ 'Feb',
62
+ 'Mar',
63
+ 'Apr',
64
+ 'May',
65
+ 'Jun',
66
+ 'Jul',
67
+ 'Aug',
68
+ 'Sep',
69
+ 'Oct',
70
+ 'Nov',
71
+ 'Dec',
72
+ ]
73
+ const longMonthNames = [
74
+ 'January',
75
+ 'February',
76
+ 'March',
77
+ 'April',
78
+ 'May',
79
+ 'June',
80
+ 'July',
81
+ 'August',
82
+ 'September',
83
+ 'October',
84
+ 'November',
85
+ 'December',
86
+ ]
87
+ const shortDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
88
+ const longDayNames = [
89
+ 'Sunday',
90
+ 'Monday',
91
+ 'Tuesday',
92
+ 'Wednesday',
93
+ 'Thursday',
94
+ 'Friday',
95
+ 'Saturday',
96
+ ]
58
97
 
59
98
  const hour12 = hour24 % 12 || 12 // 12 for 0h and 12h
60
99
  const ampmUpper = hour24 < 12 ? 'AM' : 'PM'
@@ -64,18 +103,18 @@ export class Time {
64
103
  let tzOffsetSeconds = 0
65
104
  let tzName = this._location.name
66
105
  let isUTC = false
67
-
106
+
68
107
  if (this._location.offsetSeconds !== undefined) {
69
108
  // Use the fixed offset from the location
70
109
  tzOffsetSeconds = this._location.offsetSeconds
71
- isUTC = tzOffsetSeconds === 0 && this._location.name === "UTC"
110
+ isUTC = tzOffsetSeconds === 0 && this._location.name === 'UTC'
72
111
  } else {
73
112
  // Fall back to JavaScript's timezone offset (for local time)
74
113
  const tzOffsetMinutesJS = this._date.getTimezoneOffset()
75
114
  tzOffsetSeconds = -tzOffsetMinutesJS * 60 // Convert to seconds, negate because JS offset is opposite
76
115
  isUTC = tzOffsetSeconds === 0
77
116
  }
78
-
117
+
79
118
  let tzSign = '+'
80
119
  if (tzOffsetSeconds < 0) {
81
120
  tzSign = '-'
@@ -83,7 +122,7 @@ export class Time {
83
122
  const absTzOffsetSeconds = Math.abs(tzOffsetSeconds)
84
123
  const tzOffsetHours = Math.floor(absTzOffsetSeconds / 3600)
85
124
  const tzOffsetMins = Math.floor((absTzOffsetSeconds % 3600) / 60)
86
-
125
+
87
126
  // Helper function to format fractional seconds
88
127
  const formatFracSeconds = (n: number, trimZeros: boolean): string => {
89
128
  if (n === 0 && trimZeros) return ''
@@ -96,14 +135,14 @@ export class Time {
96
135
 
97
136
  let result = ''
98
137
  let i = 0
99
-
138
+
100
139
  // Process layout character by character, matching Go's nextStdChunk logic
101
140
  while (i < layout.length) {
102
141
  let matched = false
103
-
142
+
104
143
  // Check for multi-character patterns first (longest matches first)
105
144
  const remaining = layout.slice(i)
106
-
145
+
107
146
  // Fractional seconds with comma/period
108
147
  if (remaining.match(/^[.,]999999999/)) {
109
148
  result += formatFracSeconds(nsec, true).replace('.', remaining[0])
@@ -128,11 +167,19 @@ export class Time {
128
167
  i += 10
129
168
  matched = true
130
169
  } else if (remaining.match(/^[.,]000000/)) {
131
- result += remaining[0] + Math.floor(nsec / 1000).toString().padStart(6, '0')
170
+ result +=
171
+ remaining[0] +
172
+ Math.floor(nsec / 1000)
173
+ .toString()
174
+ .padStart(6, '0')
132
175
  i += 7
133
176
  matched = true
134
177
  } else if (remaining.match(/^[.,]000/)) {
135
- result += remaining[0] + Math.floor(nsec / 1000000).toString().padStart(3, '0')
178
+ result +=
179
+ remaining[0] +
180
+ Math.floor(nsec / 1000000)
181
+ .toString()
182
+ .padStart(3, '0')
136
183
  i += 4
137
184
  matched = true
138
185
  }
@@ -253,7 +300,8 @@ export class Time {
253
300
  i += 2
254
301
  matched = true
255
302
  } else if (remaining.startsWith('_2')) {
256
- result += dayOfMonth < 10 ? ' ' + dayOfMonth.toString() : dayOfMonth.toString()
303
+ result +=
304
+ dayOfMonth < 10 ? ' ' + dayOfMonth.toString() : dayOfMonth.toString()
257
305
  i += 2
258
306
  matched = true
259
307
  } else if (remaining.startsWith('03')) {
@@ -278,15 +326,24 @@ export class Time {
278
326
  matched = true
279
327
  }
280
328
  // Single digit patterns (must come after two-digit patterns)
281
- else if (layout[i] === '3' && (i === 0 || !'0123456789'.includes(layout[i-1]))) {
329
+ else if (
330
+ layout[i] === '3' &&
331
+ (i === 0 || !'0123456789'.includes(layout[i - 1]))
332
+ ) {
282
333
  result += hour12.toString()
283
334
  i += 1
284
335
  matched = true
285
- } else if (layout[i] === '2' && (i === 0 || !'0123456789'.includes(layout[i-1]))) {
336
+ } else if (
337
+ layout[i] === '2' &&
338
+ (i === 0 || !'0123456789'.includes(layout[i - 1]))
339
+ ) {
286
340
  result += dayOfMonth.toString()
287
341
  i += 1
288
342
  matched = true
289
- } else if (layout[i] === '1' && (i === 0 || !'0123456789'.includes(layout[i-1]))) {
343
+ } else if (
344
+ layout[i] === '1' &&
345
+ (i === 0 || !'0123456789'.includes(layout[i - 1]))
346
+ ) {
290
347
  result += (month0 + 1).toString()
291
348
  i += 1
292
349
  matched = true
@@ -297,7 +354,7 @@ export class Time {
297
354
  i += 1
298
355
  matched = true
299
356
  }
300
-
357
+
301
358
  // If no pattern matched, copy the character literally
302
359
  if (!matched) {
303
360
  result += layout[i]
@@ -369,7 +426,7 @@ export class Time {
369
426
 
370
427
  // Round returns the result of rounding t to the nearest multiple of d
371
428
  // Strips monotonic reading as per Go specification
372
- public Round(d: Duration): Time {
429
+ public Round(_d: Duration): Time {
373
430
  // Implementation would round to nearest duration
374
431
  // For now, simplified version that strips monotonic reading
375
432
  return new Time(this._date, this._nsec, undefined, this._location)
@@ -377,7 +434,7 @@ export class Time {
377
434
 
378
435
  // Truncate returns the result of rounding t down to a multiple of d
379
436
  // Strips monotonic reading as per Go specification
380
- public Truncate(d: Duration): Time {
437
+ public Truncate(_d: Duration): Time {
381
438
  // Implementation would truncate to duration
382
439
  // For now, simplified version that strips monotonic reading
383
440
  return new Time(this._date, this._nsec, undefined, this._location)
@@ -511,7 +568,7 @@ export function Date(
511
568
  loc: Location,
512
569
  ): Time {
513
570
  let date: globalThis.Date
514
-
571
+
515
572
  if (loc.offsetSeconds !== undefined) {
516
573
  // For fixed timezone locations, create the date in the local timezone and then convert to UTC
517
574
  const localTime = globalThis.Date.UTC(
@@ -579,7 +636,7 @@ export async function Sleep(d: Duration): Promise<void> {
579
636
  export const May = Month.May
580
637
 
581
638
  // Time layout constants (matching Go's time package)
582
- export const DateTime = "2006-01-02 15:04:05"
639
+ export const DateTime = '2006-01-02 15:04:05'
583
640
  export const Layout = "01/02 03:04:05PM '06 -0700"
584
- export const RFC3339 = "2006-01-02T15:04:05Z07:00"
585
- export const Kitchen = "3:04PM"
641
+ export const RFC3339 = '2006-01-02T15:04:05Z07:00'
642
+ export const Kitchen = '3:04PM'
@@ -14,7 +14,7 @@ export type IntegerType = number
14
14
 
15
15
  // Alignof returns the alignment of the (type of the) variable in bytes
16
16
  // This operation is not meaningful in JavaScript/TypeScript
17
- export function Alignof(variable: ArbitraryType): number {
17
+ export function Alignof(_variable: ArbitraryType): number {
18
18
  throw new Error(
19
19
  'unsafe.Alignof is not supported in JavaScript/TypeScript: memory alignment is not a meaningful concept in JavaScript',
20
20
  )
@@ -22,7 +22,7 @@ export function Alignof(variable: ArbitraryType): number {
22
22
 
23
23
  // Offsetof returns the field offset in bytes relative to the struct's address
24
24
  // This operation is not meaningful in JavaScript/TypeScript
25
- export function Offsetof(selector: ArbitraryType): number {
25
+ export function Offsetof(_selector: ArbitraryType): number {
26
26
  throw new Error(
27
27
  'unsafe.Offsetof is not supported in JavaScript/TypeScript: memory layout and field offsets are not meaningful concepts in JavaScript',
28
28
  )
@@ -30,7 +30,7 @@ export function Offsetof(selector: ArbitraryType): number {
30
30
 
31
31
  // Sizeof returns the size of the (type of the) variable in bytes
32
32
  // This operation is not meaningful in JavaScript/TypeScript
33
- export function Sizeof(variable: ArbitraryType): number {
33
+ export function Sizeof(_variable: ArbitraryType): number {
34
34
  throw new Error(
35
35
  'unsafe.Sizeof is not supported in JavaScript/TypeScript: memory size is not a meaningful concept in JavaScript',
36
36
  )
@@ -38,7 +38,7 @@ export function Sizeof(variable: ArbitraryType): number {
38
38
 
39
39
  // Add adds len to ptr and returns the updated pointer
40
40
  // Pointer arithmetic is not supported in JavaScript/TypeScript
41
- export function Add(ptr: Pointer, len: IntegerType): Pointer {
41
+ export function Add(_ptr: Pointer, _len: IntegerType): Pointer {
42
42
  throw new Error(
43
43
  'unsafe.Add is not supported in JavaScript/TypeScript: pointer arithmetic is not available in JavaScript',
44
44
  )
@@ -46,7 +46,7 @@ export function Add(ptr: Pointer, len: IntegerType): Pointer {
46
46
 
47
47
  // Slice returns a slice whose underlying array starts at ptr
48
48
  // This operation is not meaningful in JavaScript/TypeScript
49
- export function Slice(ptr: Pointer, len: IntegerType): any[] {
49
+ export function Slice(_ptr: Pointer, _len: IntegerType): any[] {
50
50
  throw new Error(
51
51
  'unsafe.Slice is not supported in JavaScript/TypeScript: direct memory access is not available in JavaScript',
52
52
  )
@@ -54,7 +54,7 @@ export function Slice(ptr: Pointer, len: IntegerType): any[] {
54
54
 
55
55
  // SliceData returns a pointer to the underlying array of the slice
56
56
  // This operation is not meaningful in JavaScript/TypeScript
57
- export function SliceData(slice: any[]): Pointer {
57
+ export function SliceData(_slice: any[]): Pointer {
58
58
  throw new Error(
59
59
  'unsafe.SliceData is not supported in JavaScript/TypeScript: direct memory access is not available in JavaScript',
60
60
  )
@@ -62,7 +62,7 @@ export function SliceData(slice: any[]): Pointer {
62
62
 
63
63
  // String returns a string value whose underlying bytes start at ptr
64
64
  // This operation is not meaningful in JavaScript/TypeScript
65
- export function String(ptr: Pointer, len: IntegerType): string {
65
+ export function String(_ptr: Pointer, _len: IntegerType): string {
66
66
  throw new Error(
67
67
  'unsafe.String is not supported in JavaScript/TypeScript: direct memory access is not available in JavaScript',
68
68
  )
@@ -70,7 +70,7 @@ export function String(ptr: Pointer, len: IntegerType): string {
70
70
 
71
71
  // StringData returns a pointer to the underlying bytes of the str
72
72
  // This operation is not meaningful in JavaScript/TypeScript
73
- export function StringData(str: string): Pointer {
73
+ export function StringData(_str: string): Pointer {
74
74
  throw new Error(
75
75
  'unsafe.StringData is not supported in JavaScript/TypeScript: direct memory access is not available in JavaScript',
76
76
  )
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.30",
4
+ "version": "0.0.32",
5
5
  "author": {
6
6
  "name": "Aperture Robotics LLC.",
7
7
  "email": "support@aperture.us",