mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix SOA entity usage error on -vet
This commit is contained in:
@@ -35,7 +35,7 @@ the_basics :: proc() {
|
|||||||
// A comment
|
// A comment
|
||||||
|
|
||||||
my_integer_variable: int; // A comment for documentaton
|
my_integer_variable: int; // A comment for documentaton
|
||||||
|
|
||||||
// Multi-line comments begin with /* and end with */. Multi-line comments can
|
// Multi-line comments begin with /* and end with */. Multi-line comments can
|
||||||
// also be nested (unlike in C):
|
// also be nested (unlike in C):
|
||||||
/*
|
/*
|
||||||
@@ -113,7 +113,7 @@ the_basics :: proc() {
|
|||||||
// Constants can be explicitly typed like a variable declaration:
|
// Constants can be explicitly typed like a variable declaration:
|
||||||
Y : int : 123;
|
Y : int : 123;
|
||||||
Z :: Y + 7; // constant computations are possible
|
Z :: Y + 7; // constant computations are possible
|
||||||
|
|
||||||
_ = my_integer_variable;
|
_ = my_integer_variable;
|
||||||
_ = x;
|
_ = x;
|
||||||
}
|
}
|
||||||
@@ -213,8 +213,8 @@ control_flow :: proc() {
|
|||||||
|
|
||||||
// The iterated values are copies and cannot be written to.
|
// The iterated values are copies and cannot be written to.
|
||||||
// The following idiom is useful for iterating over a container in a by-reference manner:
|
// The following idiom is useful for iterating over a container in a by-reference manner:
|
||||||
for _, i in some_slice {
|
for _, idx in some_slice {
|
||||||
some_slice[i] = (i+1)*(i+1);
|
some_slice[idx] = (idx+1)*(idx+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -827,6 +827,8 @@ implicit_context_system :: proc() {
|
|||||||
// default unless explicitly specified otherwise
|
// default unless explicitly specified otherwise
|
||||||
china_grove := new(int);
|
china_grove := new(int);
|
||||||
free(china_grove);
|
free(china_grove);
|
||||||
|
|
||||||
|
_ = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
my_custom_allocator :: mem.nil_allocator;
|
my_custom_allocator :: mem.nil_allocator;
|
||||||
|
|||||||
@@ -2781,6 +2781,7 @@ Type *make_soa_struct_slice(CheckerContext *ctx, Ast *array_typ_expr, Ast *elem_
|
|||||||
new_field->flags |= EntityFlag_SoaPtrField;
|
new_field->flags |= EntityFlag_SoaPtrField;
|
||||||
soa_struct->Struct.fields[i] = new_field;
|
soa_struct->Struct.fields[i] = new_field;
|
||||||
add_entity(ctx->checker, scope, nullptr, new_field);
|
add_entity(ctx->checker, scope, nullptr, new_field);
|
||||||
|
add_entity_use(ctx, nullptr, new_field);
|
||||||
} else {
|
} else {
|
||||||
soa_struct->Struct.fields[i] = old_field;
|
soa_struct->Struct.fields[i] = old_field;
|
||||||
}
|
}
|
||||||
@@ -3056,6 +3057,7 @@ bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, Type *named_t
|
|||||||
Entity *new_field = alloc_entity_field(scope, old_field->token, array_type, false, old_field->Variable.field_src_index);
|
Entity *new_field = alloc_entity_field(scope, old_field->token, array_type, false, old_field->Variable.field_src_index);
|
||||||
soa_struct->Struct.fields[i] = new_field;
|
soa_struct->Struct.fields[i] = new_field;
|
||||||
add_entity(ctx->checker, scope, nullptr, new_field);
|
add_entity(ctx->checker, scope, nullptr, new_field);
|
||||||
|
add_entity_use(ctx, nullptr, new_field);
|
||||||
} else {
|
} else {
|
||||||
soa_struct->Struct.fields[i] = old_field;
|
soa_struct->Struct.fields[i] = old_field;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user