opt_modifiers
opt_partial
STRUCT
- {
- }
type_declaration_name
- {
+ {
+ var mods = (Modifiers) $2;
+ if ((mods & Modifiers.READONLY) != 0 && lang_version < LanguageVersion.V_7_2) {
+ FeatureIsNotAvailable (GetLocation ($4), "readonly structs");
+ }
+
lexer.ConstraintsParsing = true;
valid_param_mod = ParameterModifierType.PrimaryConstructor;
- push_current_container (new Struct (current_container, (MemberName) $6, (Modifiers) $2, (Attributes) $1), $3);
+ push_current_container (new Struct (current_container, (MemberName) $5, mods, (Attributes) $1), $3);
}
opt_primary_parameters
opt_class_base
valid_param_mod = 0;
lexer.ConstraintsParsing = false;
- if ($8 != null)
- current_type.PrimaryConstructorParameters = (ParametersCompiled) $8;
+ if ($7 != null)
+ current_type.PrimaryConstructorParameters = (ParametersCompiled) $7;
- if ($10 != null)
- current_container.SetConstraints ((List<Constraints>) $10);
+ if ($9 != null)
+ current_container.SetConstraints ((List<Constraints>) $9);
if (doc_support)
current_container.PartialContainer.DocComment = Lexer.consume_doc_comment ();
}
opt_semicolon
{
- if ($16 == null) {
- lbag.AppendToMember (current_container, GetLocation ($12), GetLocation ($15));
+ if ($15 == null) {
+ lbag.AppendToMember (current_container, GetLocation ($11), GetLocation ($14));
} else {
- lbag.AppendToMember (current_container, GetLocation ($12), GetLocation ($15), GetLocation ($17));
+ lbag.AppendToMember (current_container, GetLocation ($11), GetLocation ($14), GetLocation ($16));
}
$$ = pop_current_class ();
}