mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 21:10:30 +00:00
Fix SOA entity usage error on -vet
This commit is contained in:
@@ -35,7 +35,7 @@ the_basics :: proc() {
|
||||
// A comment
|
||||
|
||||
my_integer_variable: int; // A comment for documentaton
|
||||
|
||||
|
||||
// Multi-line comments begin with /* and end with */. Multi-line comments can
|
||||
// also be nested (unlike in C):
|
||||
/*
|
||||
@@ -113,7 +113,7 @@ the_basics :: proc() {
|
||||
// Constants can be explicitly typed like a variable declaration:
|
||||
Y : int : 123;
|
||||
Z :: Y + 7; // constant computations are possible
|
||||
|
||||
|
||||
_ = my_integer_variable;
|
||||
_ = x;
|
||||
}
|
||||
@@ -213,8 +213,8 @@ control_flow :: proc() {
|
||||
|
||||
// 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:
|
||||
for _, i in some_slice {
|
||||
some_slice[i] = (i+1)*(i+1);
|
||||
for _, idx in some_slice {
|
||||
some_slice[idx] = (idx+1)*(idx+1);
|
||||
}
|
||||
|
||||
|
||||
@@ -827,6 +827,8 @@ implicit_context_system :: proc() {
|
||||
// default unless explicitly specified otherwise
|
||||
china_grove := new(int);
|
||||
free(china_grove);
|
||||
|
||||
_ = c;
|
||||
}
|
||||
|
||||
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;
|
||||
soa_struct->Struct.fields[i] = new_field;
|
||||
add_entity(ctx->checker, scope, nullptr, new_field);
|
||||
add_entity_use(ctx, nullptr, new_field);
|
||||
} else {
|
||||
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);
|
||||
soa_struct->Struct.fields[i] = new_field;
|
||||
add_entity(ctx->checker, scope, nullptr, new_field);
|
||||
add_entity_use(ctx, nullptr, new_field);
|
||||
} else {
|
||||
soa_struct->Struct.fields[i] = old_field;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user