aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-05-13 21:09:49 +0100
committergingerBill <bill@gingerbill.org>2018-05-13 21:09:49 +0100
commit780b81a59f28c411b3a1adea217a59e1cdb4458b (patch)
tree89513b1e459fc659c795e4daaa3d22845cd2d8b5 /src/parser.cpp
parent9f1dda701d3cc7d235619d61443c1872f79cbb63 (diff)
Allow for NO_DEFAULT_STRUCT_VALUES
(will decide later if I want them or not)
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp10
1 files changed, 6 insertions, 4 deletions
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");