diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-10 15:02:34 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-10 15:02:34 +0100 |
| commit | fa3cae2bb04db76f52f1b2288a9c858f20332b8a (patch) | |
| tree | 063118fd6e63aab004680be7a87e1a7670fe4a09 /base | |
| parent | 1945218f6df814ea95233035d0b51585e2522b2e (diff) | |
Add `intrinsics.procedure_of`
```odin
foo :: proc(x: $T) { fmt.println(x) }
bar :: intrinsics.procedure_of(foo(int(123))) // parameters are never ran at compile time, similar to `size_of`
bar(333) // prints 333
```
Diffstat (limited to 'base')
| -rw-r--r-- | base/intrinsics/intrinsics.odin | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/base/intrinsics/intrinsics.odin b/base/intrinsics/intrinsics.odin index 8873f3bbc..4f6fa2713 100644 --- a/base/intrinsics/intrinsics.odin +++ b/base/intrinsics/intrinsics.odin @@ -295,6 +295,10 @@ simd_rotate_right :: proc(a: #simd[N]T, $offset: int) -> #simd[N]T --- // if all listed features are supported. has_target_feature :: proc($test: $T) -> bool where type_is_string(T) || type_is_proc(T) --- + +// Returns the value of the procedure where `x` must be a call expression +procedure_of :: proc(x: $T) -> T where type_is_proc(T) --- + // WASM targets only wasm_memory_grow :: proc(index, delta: uintptr) -> int --- wasm_memory_size :: proc(index: uintptr) -> int --- |