mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Add constant data to the identifier directly
This commit is contained in:
+13
-17
@@ -1480,23 +1480,6 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de
|
|||||||
ctx->curr_proc_sig = type;
|
ctx->curr_proc_sig = type;
|
||||||
ctx->curr_proc_calling_convention = type->Proc.calling_convention;
|
ctx->curr_proc_calling_convention = type->Proc.calling_convention;
|
||||||
|
|
||||||
if (ctx->proc_name == "sort") {
|
|
||||||
if (type->Proc.param_count > 0) {
|
|
||||||
TypeTuple *params = &type->Proc.params->Tuple;
|
|
||||||
for (Entity *e : params->variables) {
|
|
||||||
if (e->kind == Entity_Constant) {
|
|
||||||
Ast *ident = e->identifier.load();
|
|
||||||
if (ident) {
|
|
||||||
add_entity(ctx, e->scope, ident, e);
|
|
||||||
ident->tav.mode = Addressing_Constant;
|
|
||||||
ident->tav.value = e->Constant.value;
|
|
||||||
ident->tav.type = e->type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->pkg->name != "runtime") {
|
if (ctx->pkg->name != "runtime") {
|
||||||
switch (type->Proc.calling_convention) {
|
switch (type->Proc.calling_convention) {
|
||||||
case ProcCC_None:
|
case ProcCC_None:
|
||||||
@@ -1549,6 +1532,19 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add constant data to the identifier directly
|
||||||
|
for (Entity *e : params->variables) {
|
||||||
|
if (e->kind == Entity_Constant) {
|
||||||
|
Ast *ident = e->identifier.load();
|
||||||
|
if (ident) {
|
||||||
|
add_entity(ctx, e->scope, ident, e);
|
||||||
|
ident->tav.mode = Addressing_Constant;
|
||||||
|
ident->tav.value = e->Constant.value;
|
||||||
|
ident->tav.type = e->type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user