mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge pull request #4078 from funkkiy/fix-rodata-index
Error if assigning to `rodata` variable with index
This commit is contained in:
+8
-1
@@ -474,8 +474,15 @@ gb_internal Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, O
|
|||||||
rhs->proc_group = nullptr;
|
rhs->proc_group = nullptr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Ast *ident_node = nullptr;
|
||||||
|
|
||||||
if (node->kind == Ast_Ident) {
|
if (node->kind == Ast_Ident) {
|
||||||
ast_node(i, Ident, node);
|
ident_node = node;
|
||||||
|
} else if (node->kind == Ast_IndexExpr && node->IndexExpr.expr->kind == Ast_Ident) {
|
||||||
|
ident_node = node->IndexExpr.expr;
|
||||||
|
}
|
||||||
|
if (ident_node != nullptr) {
|
||||||
|
ast_node(i, Ident, ident_node);
|
||||||
e = scope_lookup(ctx->scope, i->token.string);
|
e = scope_lookup(ctx->scope, i->token.string);
|
||||||
if (e != nullptr && e->kind == Entity_Variable) {
|
if (e != nullptr && e->kind == Entity_Variable) {
|
||||||
used = (e->flags & EntityFlag_Used) != 0; // NOTE(bill): Make backup just in case
|
used = (e->flags & EntityFlag_Used) != 0; // NOTE(bill): Make backup just in case
|
||||||
|
|||||||
Reference in New Issue
Block a user