diff options
| author | gingerBill <bill@gingerbill.org> | 2021-08-15 12:56:59 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-08-15 12:56:59 +0100 |
| commit | 7bbc9a4634c2a4f1f3d4e932571883dce55c21fd (patch) | |
| tree | 5fd7a6224876544877c62d4a88725e756d13874b /src/check_expr.cpp | |
| parent | 1cd3b693aeb19a952c22e2aec69fd00025b99fc5 (diff) | |
Add `#any_int` directive to replace `auto_cast` uses on parameters.
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index cb9fce7b6..b185dd080 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4485,6 +4485,10 @@ CALL_ARGUMENT_CHECKER(check_call_arguments_internal) { bool ok = false; if (e->flags & EntityFlag_AutoCast) { ok = check_is_castable_to(c, &o, t); + } else if (e->flags & EntityFlag_AnyInt) { + if (is_type_integer(t)) { + ok = check_is_castable_to(c, &o, t); + } } if (ok) { s = assign_score_function(MAXIMUM_TYPE_DISTANCE); @@ -8730,6 +8734,12 @@ gbString write_expr_to_string(gbString str, Ast *node, bool shorthand) { if (f->flags&FieldFlag_auto_cast) { str = gb_string_appendc(str, "auto_cast "); } + if (f->flags&FieldFlag_any_int) { + str = gb_string_appendc(str, "#any_int "); + } + if (f->flags&FieldFlag_const) { + str = gb_string_appendc(str, "#const "); + } for_array(i, f->names) { Ast *name = f->names[i]; |