goscript 0.0.36 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/analysis.go +129 -8
- package/compiler/compiler.go +4 -1
- package/compiler/composite-lit.go +2 -4
- package/compiler/expr-call.go +26 -0
- package/compiler/lit.go +83 -0
- package/compiler/protobuf.go +2 -2
- package/compiler/spec-value.go +3 -3
- package/compiler/spec.go +7 -4
- package/compiler/stmt-assign.go +1 -1
- package/compiler/stmt.go +26 -8
- package/dist/gs/builtin/slice.js +2 -1
- package/dist/gs/builtin/slice.js.map +1 -1
- package/dist/gs/github.com/pkg/errors/errors.d.ts +1 -1
- package/dist/gs/github.com/pkg/errors/errors.js +182 -23
- package/dist/gs/github.com/pkg/errors/errors.js.map +1 -1
- package/dist/gs/github.com/pkg/errors/go113.d.ts +1 -1
- package/dist/gs/github.com/pkg/errors/go113.js +1 -1
- package/dist/gs/github.com/pkg/errors/go113.js.map +1 -1
- package/dist/gs/github.com/pkg/errors/index.d.ts +3 -3
- package/dist/gs/github.com/pkg/errors/index.js +3 -3
- package/dist/gs/github.com/pkg/errors/index.js.map +1 -1
- package/dist/gs/github.com/pkg/errors/stack.d.ts +1 -1
- package/dist/gs/github.com/pkg/errors/stack.js +8 -5
- package/dist/gs/github.com/pkg/errors/stack.js.map +1 -1
- package/dist/gs/internal/abi/index.d.ts +20 -0
- package/dist/gs/internal/abi/index.js +20 -0
- package/dist/gs/internal/abi/index.js.map +1 -0
- package/dist/gs/internal/bytealg/index.d.ts +2 -0
- package/dist/gs/internal/bytealg/index.js +33 -0
- package/dist/gs/internal/bytealg/index.js.map +1 -0
- package/dist/gs/internal/byteorder/index.d.ts +8 -0
- package/dist/gs/internal/byteorder/index.js +34 -0
- package/dist/gs/internal/byteorder/index.js.map +1 -0
- package/dist/gs/internal/testlog/index.d.ts +1 -0
- package/dist/gs/internal/testlog/index.js +5 -0
- package/dist/gs/internal/testlog/index.js.map +1 -0
- package/dist/gs/math/index.d.ts +44 -44
- package/dist/gs/math/index.js +44 -44
- package/dist/gs/math/index.js.map +1 -1
- package/dist/gs/os/dir.gs.d.ts +6 -0
- package/dist/gs/os/dir.gs.js +35 -0
- package/dist/gs/os/dir.gs.js.map +1 -0
- package/dist/gs/os/dir_unix.gs.d.ts +7 -0
- package/dist/gs/os/dir_unix.gs.js +113 -0
- package/dist/gs/os/dir_unix.gs.js.map +1 -0
- package/dist/gs/os/dirent_js.gs.d.ts +5 -0
- package/dist/gs/os/dirent_js.gs.js +20 -0
- package/dist/gs/os/dirent_js.gs.js.map +1 -0
- package/dist/gs/os/env.gs.d.ts +12 -0
- package/dist/gs/os/env.gs.js +157 -0
- package/dist/gs/os/env.gs.js.map +1 -0
- package/dist/gs/os/error.gs.d.ts +40 -0
- package/dist/gs/os/error.gs.js +158 -0
- package/dist/gs/os/error.gs.js.map +1 -0
- package/dist/gs/os/error_errno.gs.d.ts +1 -0
- package/dist/gs/os/error_errno.gs.js +5 -0
- package/dist/gs/os/error_errno.gs.js.map +1 -0
- package/dist/gs/os/exec.gs.d.ts +60 -0
- package/dist/gs/os/exec.gs.js +136 -0
- package/dist/gs/os/exec.gs.js.map +1 -0
- package/dist/gs/os/exec_nohandle.gs.d.ts +1 -0
- package/dist/gs/os/exec_nohandle.gs.js +2 -0
- package/dist/gs/os/exec_nohandle.gs.js.map +1 -0
- package/dist/gs/os/exec_posix.gs.d.ts +25 -0
- package/dist/gs/os/exec_posix.gs.js +67 -0
- package/dist/gs/os/exec_posix.gs.js.map +1 -0
- package/dist/gs/os/exec_unix.gs.d.ts +4 -0
- package/dist/gs/os/exec_unix.gs.js +46 -0
- package/dist/gs/os/exec_unix.gs.js.map +1 -0
- package/dist/gs/os/executable.gs.d.ts +2 -0
- package/dist/gs/os/executable.gs.js +16 -0
- package/dist/gs/os/executable.gs.js.map +1 -0
- package/dist/gs/os/executable_js.gs.d.ts +2 -0
- package/dist/gs/os/executable_js.gs.js +5 -0
- package/dist/gs/os/executable_js.gs.js.map +1 -0
- package/dist/gs/os/executable_wasm.gs.d.ts +2 -0
- package/dist/gs/os/executable_wasm.gs.js +6 -0
- package/dist/gs/os/executable_wasm.gs.js.map +1 -0
- package/dist/gs/os/file_constants_js.gs.d.ts +41 -0
- package/dist/gs/os/file_constants_js.gs.js +78 -0
- package/dist/gs/os/file_constants_js.gs.js.map +1 -0
- package/dist/gs/os/file_js.gs.d.ts +22 -0
- package/dist/gs/os/file_js.gs.js +73 -0
- package/dist/gs/os/file_js.gs.js.map +1 -0
- package/dist/gs/os/file_open_unix.gs.d.ts +6 -0
- package/dist/gs/os/file_open_unix.gs.js +10 -0
- package/dist/gs/os/file_open_unix.gs.js.map +1 -0
- package/dist/gs/os/file_posix_js.gs.d.ts +8 -0
- package/dist/gs/os/file_posix_js.gs.js +32 -0
- package/dist/gs/os/file_posix_js.gs.js.map +1 -0
- package/dist/gs/os/file_unix_js.gs.d.ts +27 -0
- package/dist/gs/os/file_unix_js.gs.js +64 -0
- package/dist/gs/os/file_unix_js.gs.js.map +1 -0
- package/dist/gs/os/getwd_js.gs.d.ts +6 -0
- package/dist/gs/os/getwd_js.gs.js +21 -0
- package/dist/gs/os/getwd_js.gs.js.map +1 -0
- package/dist/gs/os/index.d.ts +19 -0
- package/dist/gs/os/index.js +20 -0
- package/dist/gs/os/index.js.map +1 -0
- package/dist/gs/os/path.gs.d.ts +4 -0
- package/dist/gs/os/path.gs.js +32 -0
- package/dist/gs/os/path.gs.js.map +1 -0
- package/dist/gs/os/path_unix.gs.d.ts +4 -0
- package/dist/gs/os/path_unix.gs.js +40 -0
- package/dist/gs/os/path_unix.gs.js.map +1 -0
- package/dist/gs/os/pidfd_js.gs.d.ts +6 -0
- package/dist/gs/os/pidfd_js.gs.js +14 -0
- package/dist/gs/os/pidfd_js.gs.js.map +1 -0
- package/dist/gs/os/pipe_wasm.gs.d.ts +2 -0
- package/dist/gs/os/pipe_wasm.gs.js +14 -0
- package/dist/gs/os/pipe_wasm.gs.js.map +1 -0
- package/dist/gs/os/proc.gs.d.ts +11 -0
- package/dist/gs/os/proc.gs.js +68 -0
- package/dist/gs/os/proc.gs.js.map +1 -0
- package/dist/gs/os/proc_js.gs.d.ts +3 -0
- package/dist/gs/os/proc_js.gs.js +12 -0
- package/dist/gs/os/proc_js.gs.js.map +1 -0
- package/dist/gs/os/rawconn_js.gs.d.ts +10 -0
- package/dist/gs/os/rawconn_js.gs.js +26 -0
- package/dist/gs/os/rawconn_js.gs.js.map +1 -0
- package/dist/gs/os/removeall_js.gs.d.ts +2 -0
- package/dist/gs/os/removeall_js.gs.js +7 -0
- package/dist/gs/os/removeall_js.gs.js.map +1 -0
- package/dist/gs/os/root_js.gs.d.ts +23 -0
- package/dist/gs/os/root_js.gs.js +80 -0
- package/dist/gs/os/root_js.gs.js.map +1 -0
- package/dist/gs/os/root_nonwindows.gs.d.ts +2 -0
- package/dist/gs/os/root_nonwindows.gs.js +4 -0
- package/dist/gs/os/root_nonwindows.gs.js.map +1 -0
- package/dist/gs/os/root_noopenat.gs.d.ts +11 -0
- package/dist/gs/os/root_noopenat.gs.js +31 -0
- package/dist/gs/os/root_noopenat.gs.js.map +1 -0
- package/dist/gs/os/stat.gs.d.ts +24 -0
- package/dist/gs/os/stat.gs.js +20 -0
- package/dist/gs/os/stat.gs.js.map +1 -0
- package/dist/gs/os/stat_js.gs.d.ts +6 -0
- package/dist/gs/os/stat_js.gs.js +23 -0
- package/dist/gs/os/stat_js.gs.js.map +1 -0
- package/dist/gs/os/stat_unix_js.gs.d.ts +8 -0
- package/dist/gs/os/stat_unix_js.gs.js +16 -0
- package/dist/gs/os/stat_unix_js.gs.js.map +1 -0
- package/dist/gs/os/sticky_bsd.gs.d.ts +1 -0
- package/dist/gs/os/sticky_bsd.gs.js +3 -0
- package/dist/gs/os/sticky_bsd.gs.js.map +1 -0
- package/dist/gs/os/sys.gs.d.ts +2 -0
- package/dist/gs/os/sys.gs.js +10 -0
- package/dist/gs/os/sys.gs.js.map +1 -0
- package/dist/gs/os/sys_bsd.gs.d.ts +2 -0
- package/dist/gs/os/sys_bsd.gs.js +15 -0
- package/dist/gs/os/sys_bsd.gs.js.map +1 -0
- package/dist/gs/os/sys_js.gs.d.ts +2 -0
- package/dist/gs/os/sys_js.gs.js +6 -0
- package/dist/gs/os/sys_js.gs.js.map +1 -0
- package/dist/gs/os/tempfile.gs.d.ts +5 -0
- package/dist/gs/os/tempfile.gs.js +30 -0
- package/dist/gs/os/tempfile.gs.js.map +1 -0
- package/dist/gs/os/types.gs.d.ts +59 -0
- package/dist/gs/os/types.gs.js +123 -0
- package/dist/gs/os/types.gs.js.map +1 -0
- package/dist/gs/os/types_js.gs.d.ts +74 -0
- package/dist/gs/os/types_js.gs.js +147 -0
- package/dist/gs/os/types_js.gs.js.map +1 -0
- package/dist/gs/os/types_unix.gs.d.ts +40 -0
- package/dist/gs/os/types_unix.gs.js +87 -0
- package/dist/gs/os/types_unix.gs.js.map +1 -0
- package/dist/gs/os/wait_unimp.gs.d.ts +1 -0
- package/dist/gs/os/wait_unimp.gs.js +2 -0
- package/dist/gs/os/wait_unimp.gs.js.map +1 -0
- package/dist/gs/os/zero_copy_posix.gs.d.ts +4 -0
- package/dist/gs/os/zero_copy_posix.gs.js +27 -0
- package/dist/gs/os/zero_copy_posix.gs.js.map +1 -0
- package/dist/gs/os/zero_copy_stub.gs.d.ts +1 -0
- package/dist/gs/os/zero_copy_stub.gs.js +2 -0
- package/dist/gs/os/zero_copy_stub.gs.js.map +1 -0
- package/dist/gs/reflect/abi.d.ts +59 -0
- package/dist/gs/reflect/abi.gs.d.ts +59 -0
- package/dist/gs/reflect/abi.gs.js +79 -0
- package/dist/gs/reflect/abi.gs.js.map +1 -0
- package/dist/gs/reflect/abi.js +79 -0
- package/dist/gs/reflect/abi.js.map +1 -0
- package/dist/gs/reflect/badlinkname.d.ts +52 -0
- package/dist/gs/reflect/badlinkname.gs.d.ts +52 -0
- package/dist/gs/reflect/badlinkname.gs.js +72 -0
- package/dist/gs/reflect/badlinkname.gs.js.map +1 -0
- package/dist/gs/reflect/badlinkname.js +72 -0
- package/dist/gs/reflect/badlinkname.js.map +1 -0
- package/dist/gs/reflect/deepequal.d.ts +1 -0
- package/dist/gs/reflect/deepequal.gs.d.ts +25 -0
- package/dist/gs/reflect/deepequal.gs.js +308 -0
- package/dist/gs/reflect/deepequal.gs.js.map +1 -0
- package/dist/gs/reflect/deepequal.js +139 -0
- package/dist/gs/reflect/deepequal.js.map +1 -0
- package/dist/gs/reflect/float32reg_generic.gs.d.ts +2 -0
- package/dist/gs/reflect/float32reg_generic.gs.js +10 -0
- package/dist/gs/reflect/float32reg_generic.gs.js.map +1 -0
- package/dist/gs/reflect/index.d.ts +8 -0
- package/dist/gs/reflect/index.gs.d.ts +1 -0
- package/dist/gs/reflect/index.gs.js +3 -0
- package/dist/gs/reflect/index.gs.js.map +1 -0
- package/dist/gs/reflect/index.js +10 -0
- package/dist/gs/reflect/index.js.map +1 -0
- package/dist/gs/reflect/iter.d.ts +4 -0
- package/dist/gs/reflect/iter.gs.d.ts +3 -0
- package/dist/gs/reflect/iter.gs.js +24 -0
- package/dist/gs/reflect/iter.gs.js.map +1 -0
- package/dist/gs/reflect/iter.js +24 -0
- package/dist/gs/reflect/iter.js.map +1 -0
- package/dist/gs/reflect/makefunc.gs.d.ts +34 -0
- package/dist/gs/reflect/makefunc.gs.js +288 -0
- package/dist/gs/reflect/makefunc.gs.js.map +1 -0
- package/dist/gs/reflect/map.d.ts +14 -0
- package/dist/gs/reflect/map.js +70 -0
- package/dist/gs/reflect/map.js.map +1 -0
- package/dist/gs/reflect/map_swiss.gs.d.ts +14 -0
- package/dist/gs/reflect/map_swiss.gs.js +70 -0
- package/dist/gs/reflect/map_swiss.gs.js.map +1 -0
- package/dist/gs/reflect/reflect.gs.d.ts +132 -0
- package/dist/gs/reflect/reflect.gs.js +437 -0
- package/dist/gs/reflect/reflect.gs.js.map +1 -0
- package/dist/gs/reflect/swapper.d.ts +2 -0
- package/dist/gs/reflect/swapper.gs.d.ts +1 -0
- package/dist/gs/reflect/swapper.gs.js +32 -0
- package/dist/gs/reflect/swapper.gs.js.map +1 -0
- package/dist/gs/reflect/swapper.js +46 -0
- package/dist/gs/reflect/swapper.js.map +1 -0
- package/dist/gs/reflect/type.d.ts +126 -0
- package/dist/gs/reflect/type.gs.d.ts +4 -0
- package/dist/gs/reflect/type.gs.js +21 -0
- package/dist/gs/reflect/type.gs.js.map +1 -0
- package/dist/gs/reflect/type.js +825 -0
- package/dist/gs/reflect/type.js.map +1 -0
- package/dist/gs/reflect/types.d.ts +90 -0
- package/dist/gs/reflect/types.js +119 -0
- package/dist/gs/reflect/types.js.map +1 -0
- package/dist/gs/reflect/value.d.ts +13 -0
- package/dist/gs/reflect/value.gs.d.ts +4 -0
- package/dist/gs/reflect/value.gs.js +12 -0
- package/dist/gs/reflect/value.gs.js.map +1 -0
- package/dist/gs/reflect/value.js +201 -0
- package/dist/gs/reflect/value.js.map +1 -0
- package/dist/gs/reflect/visiblefields.d.ts +4 -0
- package/dist/gs/reflect/visiblefields.gs.d.ts +3 -0
- package/dist/gs/reflect/visiblefields.gs.js +123 -0
- package/dist/gs/reflect/visiblefields.gs.js.map +1 -0
- package/dist/gs/reflect/visiblefields.js +143 -0
- package/dist/gs/reflect/visiblefields.js.map +1 -0
- package/dist/gs/strconv/index.d.ts +6 -6
- package/dist/gs/strconv/index.js +6 -6
- package/dist/gs/strconv/index.js.map +1 -1
- package/dist/gs/strings/index.d.ts +1 -1
- package/dist/gs/strings/index.js +1 -1
- package/dist/gs/strings/index.js.map +1 -1
- package/dist/gs/strings/replace.js.map +1 -1
- package/dist/gs/sync/atomic/index.d.ts +4 -4
- package/dist/gs/sync/atomic/index.js +4 -4
- package/dist/gs/sync/atomic/index.js.map +1 -1
- package/dist/gs/syscall/index.d.ts +80 -0
- package/dist/gs/syscall/index.js +169 -0
- package/dist/gs/syscall/index.js.map +1 -0
- package/dist/gs/unsafe/unsafe.js.map +1 -1
- package/gs/builtin/slice.ts +2 -1
- package/gs/github.com/pkg/errors/errors.ts +408 -238
- package/gs/github.com/pkg/errors/go113.ts +5 -6
- package/gs/github.com/pkg/errors/index.ts +12 -3
- package/gs/github.com/pkg/errors/stack.ts +107 -105
- package/gs/internal/abi/index.ts +37 -0
- package/gs/internal/bytealg/index.ts +34 -0
- package/gs/internal/byteorder/index.ts +40 -0
- package/gs/math/abs.gs.test.ts +1 -1
- package/gs/math/acosh.gs.test.ts +4 -2
- package/gs/math/asin.gs.test.ts +1 -1
- package/gs/math/asinh.gs.test.ts +7 -3
- package/gs/math/atan.gs.test.ts +1 -1
- package/gs/math/atan2.gs.test.ts +17 -9
- package/gs/math/atanh.gs.test.ts +1 -1
- package/gs/math/bits.gs.test.ts +1 -1
- package/gs/math/cbrt.gs.test.ts +1 -1
- package/gs/math/const.gs.test.ts +34 -8
- package/gs/math/copysign.gs.test.ts +7 -3
- package/gs/math/dim.gs.test.ts +19 -7
- package/gs/math/erf.gs.test.ts +1 -1
- package/gs/math/erfinv.gs.test.ts +4 -2
- package/gs/math/exp.gs.test.ts +1 -1
- package/gs/math/expm1.gs.test.ts +6 -4
- package/gs/math/floor.gs.test.ts +17 -4
- package/gs/math/fma.gs.test.ts +53 -53
- package/gs/math/frexp.gs.test.ts +112 -117
- package/gs/math/gamma.gs.test.ts +1 -1
- package/gs/math/hypot.gs.test.ts +53 -53
- package/gs/math/index.ts +80 -44
- package/gs/math/j0.gs.test.ts +6 -2
- package/gs/math/j1.gs.test.ts +6 -2
- package/gs/math/jn.gs.test.ts +9 -5
- package/gs/math/ldexp.gs.test.ts +103 -86
- package/gs/math/lgamma.gs.test.ts +10 -10
- package/gs/math/log.gs.test.ts +1 -1
- package/gs/math/log10.gs.test.ts +1 -1
- package/gs/math/log1p.gs.test.ts +2 -2
- package/gs/math/logb.gs.test.ts +1 -1
- package/gs/math/mod.gs.test.ts +2 -2
- package/gs/math/modf.gs.test.ts +7 -7
- package/gs/math/nextafter.gs.test.ts +9 -7
- package/gs/math/pow.gs.test.ts +6 -4
- package/gs/math/pow10.gs.test.ts +1 -1
- package/gs/math/remainder.gs.test.ts +1 -1
- package/gs/math/signbit.gs.test.ts +1 -1
- package/gs/math/sin.gs.test.ts +1 -1
- package/gs/math/sincos.gs.test.ts +33 -14
- package/gs/math/sinh.gs.test.ts +1 -1
- package/gs/math/sqrt.gs.test.ts +1 -1
- package/gs/math/tan.gs.test.ts +3 -3
- package/gs/math/tanh.gs.test.ts +1 -1
- package/gs/os/dir.gs.ts +42 -0
- package/gs/os/dir_unix.gs.ts +155 -0
- package/gs/os/dirent_js.gs.ts +27 -0
- package/gs/os/env.gs.ts +179 -0
- package/gs/os/error.gs.ts +205 -0
- package/gs/os/error_errno.gs.ts +12 -0
- package/gs/os/exec.gs.ts +198 -0
- package/gs/os/exec_nohandle.gs.ts +2 -0
- package/gs/os/exec_posix.gs.ts +95 -0
- package/gs/os/exec_unix.gs.ts +64 -0
- package/gs/os/executable.gs.ts +18 -0
- package/gs/os/executable_js.gs.ts +6 -0
- package/gs/os/executable_wasm.gs.ts +10 -0
- package/gs/os/file_constants_js.gs.ts +98 -0
- package/gs/os/file_js.gs.ts +99 -0
- package/gs/os/file_open_unix.gs.ts +15 -0
- package/gs/os/file_posix_js.gs.ts +40 -0
- package/gs/os/file_unix_js.gs.ts +94 -0
- package/gs/os/getwd_js.gs.ts +28 -0
- package/gs/os/index.ts +128 -0
- package/gs/os/path.gs.ts +35 -0
- package/gs/os/path_unix.gs.ts +49 -0
- package/gs/os/pidfd_js.gs.ts +25 -0
- package/gs/os/pipe_wasm.gs.ts +17 -0
- package/gs/os/proc.gs.ts +84 -0
- package/gs/os/proc_js.gs.ts +15 -0
- package/gs/os/rawconn_js.gs.ts +30 -0
- package/gs/os/removeall_js.gs.ts +9 -0
- package/gs/os/root_js.gs.ts +111 -0
- package/gs/os/root_nonwindows.gs.ts +6 -0
- package/gs/os/root_noopenat.gs.ts +45 -0
- package/gs/os/stat.gs.ts +38 -0
- package/gs/os/stat_js.gs.ts +30 -0
- package/gs/os/stat_unix_js.gs.ts +27 -0
- package/gs/os/sticky_bsd.gs.ts +4 -0
- package/gs/os/sys.gs.ts +12 -0
- package/gs/os/sys_bsd.gs.ts +17 -0
- package/gs/os/sys_js.gs.ts +9 -0
- package/gs/os/tempfile.gs.ts +34 -0
- package/gs/os/types.gs.ts +170 -0
- package/gs/os/types_js.gs.ts +205 -0
- package/gs/os/types_unix.gs.ts +118 -0
- package/gs/os/wait_unimp.gs.ts +2 -0
- package/gs/os/zero_copy_posix.gs.ts +35 -0
- package/gs/os/zero_copy_stub.gs.ts +4 -0
- package/gs/reflect/ANALYSIS.md +278 -0
- package/gs/reflect/deepequal.ts +154 -0
- package/gs/reflect/function-types.test.ts +146 -0
- package/gs/reflect/godoc.txt +67 -0
- package/gs/reflect/index.ts +83 -0
- package/gs/reflect/iter.ts +44 -0
- package/gs/reflect/map.ts +81 -0
- package/gs/reflect/swapper.ts +52 -0
- package/gs/reflect/type.ts +1012 -0
- package/gs/reflect/types.ts +214 -0
- package/gs/reflect/value.ts +264 -0
- package/gs/reflect/visiblefields.ts +173 -0
- package/gs/strconv/index.ts +39 -6
- package/gs/strings/index.ts +7 -1
- package/gs/strings/replace.ts +1 -9
- package/gs/sync/atomic/index.ts +53 -4
- package/gs/syscall/index.ts +212 -0
- package/gs/unsafe/unsafe.ts +1 -1
- package/package.json +2 -1
package/gs/strings/replace.ts
CHANGED
|
@@ -434,8 +434,6 @@ class trieNode {
|
|
|
434
434
|
t!.next!.add('', val, priority, r)
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
437
|
}
|
|
440
438
|
|
|
441
439
|
class genericReplacer {
|
|
@@ -625,9 +623,7 @@ class genericReplacer {
|
|
|
625
623
|
}
|
|
626
624
|
}
|
|
627
625
|
|
|
628
|
-
function makeGenericReplacer(
|
|
629
|
-
oldnew: $.Slice<string>,
|
|
630
|
-
): genericReplacer | null {
|
|
626
|
+
function makeGenericReplacer(oldnew: $.Slice<string>): genericReplacer | null {
|
|
631
627
|
let r = new genericReplacer()
|
|
632
628
|
// Find each byte used, then assign them each an index.
|
|
633
629
|
for (let i = 0; i < $.len(oldnew); i += 2) {
|
|
@@ -789,8 +785,6 @@ class singleStringReplacer {
|
|
|
789
785
|
n += wn
|
|
790
786
|
return [n, err]
|
|
791
787
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
788
|
}
|
|
795
789
|
|
|
796
790
|
function makeSingleStringReplacer(
|
|
@@ -1065,8 +1059,6 @@ class byteStringReplacer {
|
|
|
1065
1059
|
}
|
|
1066
1060
|
return [n, err]
|
|
1067
1061
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
1062
|
}
|
|
1071
1063
|
|
|
1072
1064
|
// Helper function to copy bytes
|
package/gs/sync/atomic/index.ts
CHANGED
|
@@ -1,4 +1,53 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export {
|
|
2
|
+
AddInt32,
|
|
3
|
+
AddUint32,
|
|
4
|
+
AddUintptr,
|
|
5
|
+
AndInt32,
|
|
6
|
+
AndUint32,
|
|
7
|
+
AndUintptr,
|
|
8
|
+
CompareAndSwapInt32,
|
|
9
|
+
CompareAndSwapPointer,
|
|
10
|
+
CompareAndSwapUint32,
|
|
11
|
+
CompareAndSwapUintptr,
|
|
12
|
+
LoadInt32,
|
|
13
|
+
LoadPointer,
|
|
14
|
+
LoadUint32,
|
|
15
|
+
LoadUintptr,
|
|
16
|
+
OrInt32,
|
|
17
|
+
OrUint32,
|
|
18
|
+
OrUintptr,
|
|
19
|
+
StoreInt32,
|
|
20
|
+
StorePointer,
|
|
21
|
+
StoreUint32,
|
|
22
|
+
StoreUintptr,
|
|
23
|
+
SwapInt32,
|
|
24
|
+
SwapPointer,
|
|
25
|
+
SwapUint32,
|
|
26
|
+
SwapUintptr,
|
|
27
|
+
} from './doc.gs.js'
|
|
28
|
+
export {
|
|
29
|
+
AddInt64,
|
|
30
|
+
AddUint64,
|
|
31
|
+
AndInt64,
|
|
32
|
+
AndUint64,
|
|
33
|
+
CompareAndSwapInt64,
|
|
34
|
+
CompareAndSwapUint64,
|
|
35
|
+
LoadInt64,
|
|
36
|
+
LoadUint64,
|
|
37
|
+
OrInt64,
|
|
38
|
+
OrUint64,
|
|
39
|
+
StoreInt64,
|
|
40
|
+
StoreUint64,
|
|
41
|
+
SwapInt64,
|
|
42
|
+
SwapUint64,
|
|
43
|
+
} from './doc_64.gs.js'
|
|
44
|
+
export {
|
|
45
|
+
Bool,
|
|
46
|
+
Int32,
|
|
47
|
+
Int64,
|
|
48
|
+
Pointer,
|
|
49
|
+
Uint32,
|
|
50
|
+
Uint64,
|
|
51
|
+
Uintptr,
|
|
52
|
+
} from './type.gs.js'
|
|
53
|
+
export { Value } from './value.gs.js'
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import * as $ from '@goscript/builtin/builtin.js'
|
|
2
|
+
|
|
3
|
+
// Essential type aliases
|
|
4
|
+
export type uintptr = number
|
|
5
|
+
|
|
6
|
+
// Errno type for syscall errors
|
|
7
|
+
export interface Errno {
|
|
8
|
+
Error(): string
|
|
9
|
+
Is(target: $.GoError): boolean
|
|
10
|
+
Errno(): number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Essential syscall constants
|
|
14
|
+
export const O_RDONLY = 0
|
|
15
|
+
export const O_WRONLY = 1
|
|
16
|
+
export const O_RDWR = 2
|
|
17
|
+
export const O_APPEND = 8
|
|
18
|
+
export const O_CREATE = 64
|
|
19
|
+
export const O_EXCL = 128
|
|
20
|
+
export const O_SYNC = 256
|
|
21
|
+
export const O_TRUNC = 512
|
|
22
|
+
|
|
23
|
+
export const Stdin = 0
|
|
24
|
+
export const Stdout = 1
|
|
25
|
+
export const Stderr = 2
|
|
26
|
+
|
|
27
|
+
export const SIGINT = 2
|
|
28
|
+
export const SIGTERM = 15
|
|
29
|
+
|
|
30
|
+
// File mode constants
|
|
31
|
+
export const S_IFMT = 0o170000
|
|
32
|
+
export const S_IFREG = 0o100000
|
|
33
|
+
export const S_IFDIR = 0o040000
|
|
34
|
+
export const S_IFLNK = 0o120000
|
|
35
|
+
export const S_IFBLK = 0o060000
|
|
36
|
+
export const S_IFCHR = 0o020000
|
|
37
|
+
export const S_IFIFO = 0o010000
|
|
38
|
+
export const S_IFSOCK = 0o140000
|
|
39
|
+
export const S_ISUID = 0o004000
|
|
40
|
+
export const S_ISGID = 0o002000
|
|
41
|
+
export const S_ISVTX = 0o001000
|
|
42
|
+
|
|
43
|
+
// Environment variable functions using Node.js/browser APIs
|
|
44
|
+
export function Getenv(key: string): [string, boolean] {
|
|
45
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
46
|
+
const value = process.env[key]
|
|
47
|
+
return value !== undefined ? [value, true] : ['', false]
|
|
48
|
+
}
|
|
49
|
+
return ['', false]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function Setenv(key: string, value: string): $.GoError {
|
|
53
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
54
|
+
process.env[key] = value
|
|
55
|
+
return null
|
|
56
|
+
}
|
|
57
|
+
return { Error: () => 'setenv not supported' }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function Unsetenv(key: string): $.GoError {
|
|
61
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
62
|
+
delete process.env[key]
|
|
63
|
+
return null
|
|
64
|
+
}
|
|
65
|
+
return { Error: () => 'unsetenv not supported' }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function Clearenv(): void {
|
|
69
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
70
|
+
for (const key in process.env) {
|
|
71
|
+
delete process.env[key]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function Environ(): $.Slice<string> {
|
|
77
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
78
|
+
const env: string[] = []
|
|
79
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
80
|
+
if (value !== undefined) {
|
|
81
|
+
env.push(`${key}=${value}`)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return $.arrayToSlice(env)
|
|
85
|
+
}
|
|
86
|
+
return $.arrayToSlice([])
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Dirent structure with Reclen field
|
|
90
|
+
export class Dirent {
|
|
91
|
+
public Name: $.Bytes = new Uint8Array(0)
|
|
92
|
+
public Reclen: number = 0
|
|
93
|
+
constructor(init?: any) {
|
|
94
|
+
if (init?.Name) this.Name = init.Name
|
|
95
|
+
if (init?.Reclen) this.Reclen = init.Reclen
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Stat_t structure stub
|
|
100
|
+
export class Stat_t {
|
|
101
|
+
public Dev: number = 0
|
|
102
|
+
public Ino: number = 0
|
|
103
|
+
public Mode: number = 0
|
|
104
|
+
public Nlink: number = 0
|
|
105
|
+
public Uid: number = 0
|
|
106
|
+
public Gid: number = 0
|
|
107
|
+
public Rdev: number = 0
|
|
108
|
+
public Size: number = 0
|
|
109
|
+
public Blksize: number = 0
|
|
110
|
+
public Blocks: number = 0
|
|
111
|
+
public Atime: number = 0
|
|
112
|
+
public Mtime: number = 0
|
|
113
|
+
public Ctime: number = 0
|
|
114
|
+
public AtimeNsec: number = 0
|
|
115
|
+
public MtimeNsec: number = 0
|
|
116
|
+
public CtimeNsec: number = 0
|
|
117
|
+
|
|
118
|
+
constructor(init?: any) {
|
|
119
|
+
if (init) {
|
|
120
|
+
Object.assign(this, init)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public clone(): Stat_t {
|
|
125
|
+
return new Stat_t(this)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// RawConn interface - stub implementation for JavaScript environment
|
|
130
|
+
export interface RawConn {
|
|
131
|
+
Control(f: (fd: uintptr) => void): $.GoError
|
|
132
|
+
Read(f: (fd: uintptr) => boolean): $.GoError
|
|
133
|
+
Write(f: (fd: uintptr) => boolean): $.GoError
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Stub implementation of RawConn that always returns ErrUnimplemented
|
|
137
|
+
export class StubRawConn implements RawConn {
|
|
138
|
+
Control(_f: (fd: uintptr) => void): $.GoError {
|
|
139
|
+
return {
|
|
140
|
+
Error: () => 'operation not implemented in JavaScript environment',
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
Read(_f: (fd: uintptr) => boolean): $.GoError {
|
|
145
|
+
return {
|
|
146
|
+
Error: () => 'operation not implemented in JavaScript environment',
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
Write(_f: (fd: uintptr) => boolean): $.GoError {
|
|
151
|
+
return {
|
|
152
|
+
Error: () => 'operation not implemented in JavaScript environment',
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Additional error constants - implement as Errno type
|
|
158
|
+
export const ENOSYS: Errno = {
|
|
159
|
+
Error: () => 'function not implemented',
|
|
160
|
+
Is: (target: $.GoError) => target === ENOSYS,
|
|
161
|
+
Errno: () => 38,
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export const EISDIR: Errno = {
|
|
165
|
+
Error: () => 'is a directory',
|
|
166
|
+
Is: (target: $.GoError) => target === EISDIR,
|
|
167
|
+
Errno: () => 21,
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export const ENOTDIR: Errno = {
|
|
171
|
+
Error: () => 'not a directory',
|
|
172
|
+
Is: (target: $.GoError) => target === ENOTDIR,
|
|
173
|
+
Errno: () => 20,
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export const ERANGE: Errno = {
|
|
177
|
+
Error: () => 'result too large',
|
|
178
|
+
Is: (target: $.GoError) => target === ERANGE,
|
|
179
|
+
Errno: () => 34,
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export const ENOMEM: Errno = {
|
|
183
|
+
Error: () => 'out of memory',
|
|
184
|
+
Is: (target: $.GoError) => target === ENOMEM,
|
|
185
|
+
Errno: () => 12,
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export const ESRCH: Errno = {
|
|
189
|
+
Error: () => 'no such process',
|
|
190
|
+
Is: (target: $.GoError) => target === ESRCH,
|
|
191
|
+
Errno: () => 3,
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Additional missing syscall functions
|
|
195
|
+
export function Open(
|
|
196
|
+
_path: string,
|
|
197
|
+
_flag: number,
|
|
198
|
+
_perm: number,
|
|
199
|
+
): [number, $.GoError] {
|
|
200
|
+
return [-1, ENOSYS]
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function Sysctl(_name: string): [string, $.GoError] {
|
|
204
|
+
return ['', ENOSYS]
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Getpagesize returns the underlying system's memory page size.
|
|
208
|
+
export function Getpagesize(): number {
|
|
209
|
+
// Return a standard page size for JavaScript environment
|
|
210
|
+
// Most systems use 4096 bytes as the default page size
|
|
211
|
+
return 4096
|
|
212
|
+
}
|
package/gs/unsafe/unsafe.ts
CHANGED
|
@@ -79,5 +79,5 @@ export function StringData(_str: string): Pointer {
|
|
|
79
79
|
// Pointer converts a value to an unsafe.Pointer for atomic operations
|
|
80
80
|
// In JavaScript/TypeScript, this is just a pass-through function
|
|
81
81
|
export function Pointer(value: any): Pointer {
|
|
82
|
-
return value
|
|
82
|
+
return value
|
|
83
83
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goscript",
|
|
3
3
|
"description": "Go to TypeScript transpiler",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.38",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Aperture Robotics LLC.",
|
|
7
7
|
"email": "support@aperture.us",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"lint": "npm run lint:go && npm run lint:js",
|
|
64
64
|
"lint:go": "make lint",
|
|
65
65
|
"lint:js": "eslint -c eslint.config.mjs ./",
|
|
66
|
+
"lint:js:fix": "eslint -c eslint.config.mjs ./ --fix",
|
|
66
67
|
"prepare": "husky",
|
|
67
68
|
"precommit": "lint-staged"
|
|
68
69
|
},
|