From 780b81a59f28c411b3a1adea217a59e1cdb4458b Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 13 May 2018 21:09:49 +0100 Subject: Allow for NO_DEFAULT_STRUCT_VALUES (will decide later if I want them or not) --- src/parser.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/parser.cpp') diff --git a/src/parser.cpp b/src/parser.cpp index d0128b7dd..c30ca4779 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -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"); -- cgit v1.2.3