void case_292()
#line 2435 "cs-parser.jay"
{
valid_param_mod = 0;
current_local_parameters = (ParametersCompiled) yyVals[-1+yyTop];
var lt = (LocatedToken) yyVals[-4+yyTop];
var mods = (Modifiers) yyVals[-5+yyTop];
var c = new Constructor (current_type, lt.Value, mods, (Attributes) yyVals[-6+yyTop], current_local_parameters, lt.Location);
if (lt.Value != current_container.MemberName.Name) {
report.Error (1520, c.Location, "Class, struct, or interface method must have a return type");
} else if ((mods & Modifiers.STATIC) != 0) {
if (!current_local_parameters.IsEmpty) {
report.Error (132, c.Location, "`{0}': The static constructor must be parameterless",
c.GetSignatureForError ());
}
if ((mods & Modifiers.AccessibilityMask) != 0){
report.Error (515, c.Location,
"`{0}': static constructor cannot have an access modifier",
c.GetSignatureForError ());
}
} else {
if (current_type.Kind == MemberKind.Struct && current_local_parameters.IsEmpty) {
if (lang_version < LanguageVersion.V_6)
FeatureIsNotAvailable (GetLocation (yyVals[-4+yyTop]), "struct parameterless instance constructor");
if ((mods & Modifiers.PUBLIC) == 0) {
report.Error (8075, c.Location, "`{0}': Structs parameterless instance constructor must be public", c.GetSignatureForError ());
}
}
}
current_type.AddConstructor (c);
lbag.AddMember (c, GetModifierLocations (), GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
yyVal = c;
/**/
/* start block here, so possible anonymous methods inside*/
/* constructor initializer can get correct parent block*/
/**/
start_block (lexer.Location);
}
void case_293()
#line 2478 "cs-parser.jay"
{
if (yyVals[0+yyTop] != null) {
var c = (Constructor) yyVals[-1+yyTop];
c.Initializer = (ConstructorInitializer) yyVals[0+yyTop];
if (c.IsStatic) {
report.Error (514, c.Location,
"`{0}': static constructor cannot have an explicit `this' or `base' constructor call",
c.GetSignatureForError ());
}
}
yyVal = yyVals[-1+yyTop];
}
void case_299()
#line 2510 "cs-parser.jay"
{
--lexer.parsing_block;
yyVal = new ConstructorBaseInitializer ((Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop]));
}
void case_301()
#line 2520 "cs-parser.jay"
{
--lexer.parsing_block;
yyVal = new ConstructorThisInitializer ((Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop]));
}
void case_302()
#line 2526 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new ConstructorThisInitializer (null, GetLocation (yyVals[0+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
void case_303()
#line 2532 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = null;
}
void case_304()
#line 2540 "cs-parser.jay"
{
if (doc_support) {
tmpComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.NotAllowed;
}
current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters;
}
void case_305()
#line 2549 "cs-parser.jay"
{
var lt = (LocatedToken) yyVals[-3+yyTop];
if (lt.Value != current_container.MemberName.Name){
report.Error (574, lt.Location, "Name of destructor must match name of class");
} else if (current_container.Kind != MemberKind.Class){
report.Error (575, lt.Location, "Only class types can contain destructor");
}
Destructor d = new Destructor (current_type, (Modifiers) yyVals[-6+yyTop],
ParametersCompiled.EmptyReadOnlyParameters, (Attributes) yyVals[-7+yyTop], lt.Location);
d.Identifier = lt.Value;
if (doc_support)
d.DocComment = ConsumeStoredComment ();
d.Block = (ToplevelBlock) yyVals[0+yyTop];
current_type.AddMember (d);
lbag.AddMember (d, GetModifierLocations (), GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[-1+yyTop]));
current_local_parameters = null;
}
void case_306()
#line 2575 "cs-parser.jay"
{
current_event_field = new EventField (current_type, (FullNamedExpression) yyVals[-1+yyTop], (Modifiers) yyVals[-3+yyTop], (MemberName) yyVals[0+yyTop], (Attributes) yyVals[-4+yyTop]);
current_type.AddMember (current_event_field);
if (current_event_field.MemberName.ExplicitInterface != null) {
report.Error (71, current_event_field.Location, "`{0}': An explicit interface implementation of an event must use property syntax",
current_event_field.GetSignatureForError ());
}
yyVal = current_event_field;
}
void case_307()
#line 2589 "cs-parser.jay"
{
if (doc_support) {
current_event_field.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
if (current_event_field.Initializer != null) {
lbag.AddMember (current_event_field, GetModifierLocations (), GetLocation (yyVals[-6+yyTop]), savedEventAssignLocation, GetLocation (yyVals[0+yyTop]));
} else {
lbag.AddMember (current_event_field, GetModifierLocations (), GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[0+yyTop]));
}
current_event_field = null;
}
void case_308()
#line 2605 "cs-parser.jay"
{
current_event = new EventProperty (current_type, (FullNamedExpression) yyVals[-2+yyTop], (Modifiers) yyVals[-4+yyTop], (MemberName) yyVals[-1+yyTop], (Attributes) yyVals[-5+yyTop]);
current_type.AddMember (current_event);
lbag.AddMember (current_event, GetModifierLocations (), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop]));
lexer.EventParsing = true;
}
void case_309()
#line 2613 "cs-parser.jay"
{
if (current_container.Kind == MemberKind.Interface)
report.Error (69, GetLocation (yyVals[-2+yyTop]), "Event in interface cannot have add or remove accessors");
lexer.EventParsing = false;
}
void case_310()
#line 2620 "cs-parser.jay"
{
if (doc_support) {
current_event.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
lbag.AppendToMember (current_event, GetLocation (yyVals[-1+yyTop]));
current_event = null;
current_local_parameters = null;
}
void case_311()
#line 2633 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
current_type.AddMember (new EventField (current_type, (FullNamedExpression) yyVals[-1+yyTop], (Modifiers) yyVals[-3+yyTop], MemberName.Null, (Attributes) yyVals[-4+yyTop]));
}
void case_314()
#line 2647 "cs-parser.jay"
{
--lexer.parsing_block;
savedEventAssignLocation = GetLocation (yyVals[-2+yyTop]);
current_event_field.Initializer = (Expression) yyVals[0+yyTop];
}
void case_319()
#line 2672 "cs-parser.jay"
{
var lt = (LocatedToken) yyVals[0+yyTop];
yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
void case_321()
#line 2682 "cs-parser.jay"
{
--lexer.parsing_block;
var lt = (LocatedToken) yyVals[-3+yyTop];
yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop]));
}
void case_322()
#line 2691 "cs-parser.jay"
{
if (current_container.Kind == MemberKind.Interface) {
report.Error (68, lexer.Location, "`{0}': event in interface cannot have an initializer",
current_event_field.GetSignatureForError ());
}
if ((current_event_field.ModFlags & Modifiers.ABSTRACT) != 0) {
report.Error (74, lexer.Location, "`{0}': abstract event cannot have an initializer",
current_event_field.GetSignatureForError ());
}
}
void case_326()
#line 2712 "cs-parser.jay"
{
report.Error (65, lexer.Location, "`{0}': event property must have both add and remove accessors",
current_event.GetSignatureForError ());
}
void case_327()
#line 2717 "cs-parser.jay"
{
report.Error (65, lexer.Location, "`{0}': event property must have both add and remove accessors",
current_event.GetSignatureForError ());
}
void case_328()
#line 2722 "cs-parser.jay"
{
report.Error (1055, GetLocation (yyVals[0+yyTop]), "An add or remove accessor expected");
yyVal = null;
}
void case_329()
#line 2730 "cs-parser.jay"
{
if (yyVals[-1+yyTop] != ModifierNone) {
report.Error (1609, GetLocation (yyVals[-1+yyTop]), "Modifiers cannot be placed on event accessor declarations");
}
current_event.Add = new EventProperty.AddDelegateMethod (current_event, (Attributes) yyVals[-2+yyTop], GetLocation (yyVals[0+yyTop]));
current_local_parameters = current_event.Add.ParameterInfo;
lbag.AddMember (current_event.Add, GetModifierLocations ());
lexer.EventParsing = false;
}
void case_330()
#line 2742 "cs-parser.jay"
{
lexer.EventParsing = true;
current_event.Add.Block = (ToplevelBlock) yyVals[0+yyTop];
if (current_container.Kind == MemberKind.Interface) {
report.Error (531, current_event.Add.Block.StartLocation,
"`{0}': interface members cannot have a definition", current_event.Add.GetSignatureForError ());
}
current_local_parameters = null;
}
void case_331()
#line 2758 "cs-parser.jay"
{
if (yyVals[-1+yyTop] != ModifierNone) {
report.Error (1609, GetLocation (yyVals[-1+yyTop]), "Modifiers cannot be placed on event accessor declarations");
}
current_event.Remove = new EventProperty.RemoveDelegateMethod (current_event, (Attributes) yyVals[-2+yyTop], GetLocation (yyVals[0+yyTop]));
current_local_parameters = current_event.Remove.ParameterInfo;
lbag.AddMember (current_event.Remove, GetModifierLocations ());
lexer.EventParsing = false;
}
void case_332()
#line 2770 "cs-parser.jay"
{
lexer.EventParsing = true;
current_event.Remove.Block = (ToplevelBlock) yyVals[0+yyTop];
if (current_container.Kind == MemberKind.Interface) {
report.Error (531, current_event.Remove.Block.StartLocation,
"`{0}': interface members cannot have a definition", current_event.Remove.GetSignatureForError ());
}
current_local_parameters = null;
}
void case_333()
#line 2786 "cs-parser.jay"
{
report.Error (73, lexer.Location, "An add or remove accessor must have a body");
yyVal = null;
}
void case_335()
#line 2795 "cs-parser.jay"
{
current_type.UnattachedAttributes = (Attributes) yyVals[-1+yyTop];
report.Error (1519, GetLocation (yyVals[-1+yyTop]), "An attribute is missing member declaration");
lexer.putback ('}');
}
void case_336()
#line 2806 "cs-parser.jay"
{
report.Error (1519, lexer.Location, "Unexpected symbol `}' in class, struct, or interface member declaration");
lexer.putback ('}');
lexer.parsing_generic_declaration = false;
FullNamedExpression type = (FullNamedExpression) yyVals[-1+yyTop];
current_field = new Field (current_type, type, (Modifiers) yyVals[-2+yyTop], MemberName.Null, (Attributes) yyVals[-3+yyTop]);
current_type.AddField (current_field);
lbag.AddMember (current_field, GetModifierLocations ());
yyVal = current_field;
}
void case_337()
#line 2826 "cs-parser.jay"
{
if (doc_support)
enumTypeComment = Lexer.consume_doc_comment ();
}
void case_338()
#line 2831 "cs-parser.jay"
{
if (doc_support)
Lexer.doc_state = XmlCommentState.Allowed;
MemberName name = (MemberName) yyVals[-3+yyTop];
if (name.IsGeneric) {
report.Error (1675, name.Location, "Enums cannot have type parameters");
}
push_current_container (new Enum (current_container, (FullNamedExpression) yyVals[-2+yyTop], (Modifiers) yyVals[-5+yyTop], name, (Attributes) yyVals[-6+yyTop]), null);
if (yyVals[-2+yyTop] != null) {
lbag.AddMember (current_container, GetModifierLocations (), GetLocation (yyVals[-4+yyTop]), savedLocation, GetLocation (yyVals[0+yyTop]));
} else {
lbag.AddMember (current_container, GetModifierLocations (), GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[0+yyTop]));
}
}
void case_339()
#line 2848 "cs-parser.jay"
{
lexer.parsing_modifiers = true;
/* here will be evaluated after CLOSE_BLACE is consumed.*/
if (doc_support)
Lexer.doc_state = XmlCommentState.Allowed;
}