mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-08 14:03:14 +00:00
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
```
This commit is contained in:
@@ -2224,8 +2224,16 @@ gb_internal void check_expr_stmt(CheckerContext *ctx, Ast *node) {
|
||||
}
|
||||
if (do_require) {
|
||||
gbString expr_str = expr_to_string(ce->proc);
|
||||
defer (gb_string_free(expr_str));
|
||||
if (builtin_id) {
|
||||
String real_name = builtin_procs[builtin_id].name;
|
||||
if (real_name != make_string(cast(u8 const *)expr_str, gb_string_length(expr_str))) {
|
||||
error(node, "'%s' ('%.*s.%.*s') requires that its results must be handled", expr_str,
|
||||
LIT(builtin_proc_pkg_name[builtin_procs[builtin_id].pkg]), LIT(real_name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
error(node, "'%s' requires that its results must be handled", expr_str);
|
||||
gb_string_free(expr_str);
|
||||
}
|
||||
return;
|
||||
} else if (expr && expr->kind == Ast_SelectorCallExpr) {
|
||||
|
||||
Reference in New Issue
Block a user