mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-28 16:01:31 +00:00
Merge pull request #7432 from kalsprite/asm_immediate_constant
Reject a non-constant argument to an template's immediate
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -277,6 +277,8 @@ odin
|
||||
*.bin
|
||||
demo.bin
|
||||
libLLVM*.so*
|
||||
*.a
|
||||
*.o
|
||||
|
||||
# core:rexcode commits its generated encode/decode tables: each arch's tablegen
|
||||
# emits human-readable Odin, serialized to tables/*.bin, which the library
|
||||
@@ -321,5 +323,3 @@ build/
|
||||
cmake-build*/
|
||||
CMakeLists.txt
|
||||
sandbox/
|
||||
|
||||
vendor/box3d/lib/box3d_wasm.o
|
||||
|
||||
@@ -7008,6 +7008,18 @@ gb_internal CallArgumentError check_call_arguments_internal(CheckerContext *c, A
|
||||
}
|
||||
}
|
||||
|
||||
// an `asm` template's `$` parameter is encoded as an immediate, so only a constant can reach it
|
||||
if (e && e->kind == Entity_Variable && (e->flags & EntityFlag_PolyConst)) {
|
||||
if (o->mode != Addressing_Constant) {
|
||||
if (show_error) {
|
||||
gbString str = expr_to_string(o->expr);
|
||||
error(o->expr, "Expected a constant value for the '$' immediate '%.*s', got %s", LIT(e->token.string), str);
|
||||
gb_string_free(str);
|
||||
}
|
||||
err = CallArgumentError_NoneConstantParameter;
|
||||
}
|
||||
}
|
||||
|
||||
if (e && e->kind == Entity_Constant && is_type_proc(e->type)) {
|
||||
bool ok = false;
|
||||
if (o->mode == Addressing_Constant) {
|
||||
|
||||
Reference in New Issue
Block a user