mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 11:20:08 +00:00
Allow for NO_DEFAULT_STRUCT_VALUES
(will decide later if I want them or not)
This commit is contained in:
+1
-1
@@ -684,7 +684,7 @@ Type *ir_type(irValue *value) {
|
||||
|
||||
|
||||
bool ir_type_has_default_values(Type *t) {
|
||||
#if 1
|
||||
#if !defined(NO_DEFAULT_STRUCT_VALUES)
|
||||
switch (t->kind) {
|
||||
case Type_Named:
|
||||
return ir_type_has_default_values(t->Named.base);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// #define NO_ARRAY_BOUNDS_CHECK
|
||||
#define NO_POINTER_ARITHMETIC
|
||||
// #define NO_DEFAULT_STRUCT_VALUES
|
||||
|
||||
#include "common.cpp"
|
||||
#include "timings.cpp"
|
||||
|
||||
+6
-4
@@ -2959,10 +2959,12 @@ AstNode *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, Tok
|
||||
syntax_error(f->curr_token, "Default parameters can only be applied to single values");
|
||||
}
|
||||
|
||||
// if (allowed_flags == FieldFlag_Struct && default_value != nullptr) {
|
||||
// syntax_error(default_value, "Default parameters are not allowed for structs");
|
||||
// default_value = nullptr;
|
||||
// }
|
||||
#if defined(NO_DEFAULT_STRUCT_VALUES)
|
||||
if (allowed_flags == FieldFlag_Struct && default_value != nullptr) {
|
||||
syntax_error(default_value, "Default parameters are not allowed for structs");
|
||||
default_value = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (type != nullptr && type->kind == AstNode_Ellipsis) {
|
||||
if (seen_ellipsis) syntax_error(type, "Extra variadic parameter after ellipsis");
|
||||
|
||||
Reference in New Issue
Block a user