diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-06-03 20:01:22 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-06-04 11:08:25 +0200 |
| commit | ae5c92ac38dd7facce8a61b110e08b1b4a2a4238 (patch) | |
| tree | 16e78531439db7fce856f93ff4f064647f40eaad /core | |
| parent | 986cfbcaf4aa6300109e93c114e439d2578887af (diff) | |
Enable `odin check examples/all` for JS.
Diffstat (limited to 'core')
| -rw-r--r-- | core/compress/common.odin | 3 | ||||
| -rw-r--r-- | core/path/filepath/path_js.odin | 36 | ||||
| -rw-r--r-- | core/sys/info/sysinfo.odin | 2 | ||||
| -rw-r--r-- | core/time/timezone/tz_js.odin | 13 |
4 files changed, 50 insertions, 4 deletions
diff --git a/core/compress/common.odin b/core/compress/common.odin index 242538e78..f4429b667 100644 --- a/core/compress/common.odin +++ b/core/compress/common.odin @@ -139,9 +139,6 @@ Context_Memory_Input :: struct #packed { } when size_of(rawptr) == 8 { #assert(size_of(Context_Memory_Input) == 64) -} else { - // e.g. `-target:windows_i386` - #assert(size_of(Context_Memory_Input) == 52) } Context_Stream_Input :: struct #packed { diff --git a/core/path/filepath/path_js.odin b/core/path/filepath/path_js.odin new file mode 100644 index 000000000..3b5ac04f5 --- /dev/null +++ b/core/path/filepath/path_js.odin @@ -0,0 +1,36 @@ +package filepath + +import "base:runtime" + +import "core:strings" + +SEPARATOR :: '/' +SEPARATOR_STRING :: `/` +LIST_SEPARATOR :: ':' + +is_reserved_name :: proc(path: string) -> bool { + return false +} + +is_abs :: proc(path: string) -> bool { + return strings.has_prefix(path, "/") +} + +abs :: proc(path: string, allocator := context.allocator) -> (string, bool) { + if is_abs(path) { + return strings.clone(string(path), allocator), true + } + + return path, false +} + +join :: proc(elems: []string, allocator := context.allocator) -> (joined: string, err: runtime.Allocator_Error) #optional_allocator_error { + for e, i in elems { + if e != "" { + runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD(ignore = context.temp_allocator == allocator) + p := strings.join(elems[i:], SEPARATOR_STRING, context.temp_allocator) or_return + return clean(p, allocator) + } + } + return "", nil +}
\ No newline at end of file diff --git a/core/sys/info/sysinfo.odin b/core/sys/info/sysinfo.odin index f624a1718..75cc237c6 100644 --- a/core/sys/info/sysinfo.odin +++ b/core/sys/info/sysinfo.odin @@ -1,6 +1,6 @@ package sysinfo -when !(ODIN_ARCH == .amd64 || ODIN_ARCH == .i386 || ODIN_ARCH == .arm32 || ODIN_ARCH == .arm64 || ODIN_ARCH == .riscv64) { +when !(ODIN_ARCH == .amd64 || ODIN_ARCH == .i386 || ODIN_ARCH == .arm32 || ODIN_ARCH == .arm64 || ODIN_ARCH == .riscv64 || ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32) { #assert(false, "This package is unsupported on this architecture.") } diff --git a/core/time/timezone/tz_js.odin b/core/time/timezone/tz_js.odin new file mode 100644 index 000000000..d63e40033 --- /dev/null +++ b/core/time/timezone/tz_js.odin @@ -0,0 +1,13 @@ +#+build js +#+private +package timezone + +import "core:time/datetime" + +local_tz_name :: proc(allocator := context.allocator) -> (name: string, success: bool) { + return +} + +_region_load :: proc(_reg_str: string, allocator := context.allocator) -> (out_reg: ^datetime.TZ_Region, success: bool) { + return nil, true +}
\ No newline at end of file |