aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-02-17 13:02:41 +0000
committergingerBill <bill@gingerbill.org>2023-02-17 13:02:41 +0000
commitc40b6c7c2fd8e193951087197c60a1359ad0002b (patch)
treef09cb5423dd5d394bdfd61f4435078313f235fd8 /src/check_decl.cpp
parent896b7145b3e909e9318d85d87e36829e0e9476ca (diff)
Add constant data to the identifier directly
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index dc929cbca..1adb1e2ed 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -1480,23 +1480,6 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de
ctx->curr_proc_sig = type;
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") {
switch (type->Proc.calling_convention) {
case ProcCC_None:
@@ -1549,6 +1532,19 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de
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;
+ }
+ }
+ }
}
}