X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fcs-parser.jay;h=a9748379086bbde75a62e2c78329576af82f3755;hb=440a7c06af698fb611825258a0a015d7d3d6176b;hp=d6f4a51e3708a3982427460cb719095f44995607;hpb=f52380fc7c2dddba6444be1897c4e213e3570127;p=mono.git diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay index d6f4a51e370..a9748379086 100644 --- a/mcs/mcs/cs-parser.jay +++ b/mcs/mcs/cs-parser.jay @@ -400,6 +400,17 @@ outer_declaration } | opt_extern_alias_directives opt_using_directives attribute_sections { + Attributes attrs = (Attributes) $3; + if (attrs != null) { + foreach (var a in attrs.Attrs) { + if (a.ExplicitTarget == "assembly" || a.ExplicitTarget == "module") + continue; + + if (a.ExplicitTarget == null) + report.Error (-1671, a.Location, "Global attributes must have attribute target specified"); + } + } + module.AddAttributes ((Attributes) $3, current_namespace); } | error @@ -1818,9 +1829,9 @@ property_declaration accessor_declarations { lexer.PropertyParsing = false; - + if (doc_support) - current_property.DocComment = ConsumeStoredComment (); + current_property.DocComment = ConsumeStoredComment (); } CLOSE_BRACE { @@ -1858,6 +1869,9 @@ property_declaration if (type.Type != null && type.Type.Kind == MemberKind.Void) report.Error (547, GetLocation ($3), "`{0}': property or indexer cannot have void type", property.GetSignatureForError ()); + if (doc_support) + property.DocComment = ConsumeStoredComment (); + current_type.AddMember (property); current_local_parameters = null; @@ -1879,6 +1893,9 @@ opt_property_initializer lbag.AppendToMember (current_property, GetLocation ($1), GetLocation ($4)); end_block (GetLocation ($4)); current_local_parameters = null; + + if (doc_support) + Lexer.doc_state = XmlCommentState.Allowed; } ; @@ -2403,12 +2420,7 @@ constructor_declarator } } else { if (current_type.Kind == MemberKind.Struct && current_local_parameters.IsEmpty) { - if (lang_version < LanguageVersion.V_6) - FeatureIsNotAvailable (GetLocation ($3), "struct parameterless instance constructor"); - - if ((mods & Modifiers.PUBLIC) == 0) { - report.Error (8075, c.Location, "`{0}': Structs parameterless instance constructor must be public", c.GetSignatureForError ()); - } + report.Error (568, c.Location, "Structs cannot contain explicit parameterless constructors"); } } @@ -3339,10 +3351,16 @@ boolean_literal interpolated_string : INTERPOLATED_STRING interpolations INTERPOLATED_STRING_END { + if (lang_version < LanguageVersion.V_6) + FeatureIsNotAvailable (GetLocation ($1), "interpolated strings"); + $$ = new InterpolatedString ((StringLiteral) $1, (List) $2, (StringLiteral) $3); } | INTERPOLATED_STRING_END { + if (lang_version < LanguageVersion.V_6) + FeatureIsNotAvailable (GetLocation ($1), "interpolated strings"); + $$ = new InterpolatedString ((StringLiteral) $1, null, null); } ; @@ -3611,12 +3629,12 @@ member_initializer lbag.AddLocation ($$, GetLocation ($3)); } - | OPEN_BRACKET_EXPR expression_list CLOSE_BRACKET ASSIGN initializer_value + | OPEN_BRACKET_EXPR argument_list CLOSE_BRACKET ASSIGN initializer_value { if (lang_version < LanguageVersion.V_6) FeatureIsNotAvailable (GetLocation ($1), "dictionary initializer"); - $$ = new DictionaryElementInitializer ((List)$2, (Expression) $5, GetLocation ($1)); + $$ = new DictionaryElementInitializer ((Arguments)$2, (Expression) $5, GetLocation ($1)); lbag.AddLocation ($$, GetLocation ($3), GetLocation ($4)); } | OPEN_BRACE CLOSE_BRACE @@ -3906,7 +3924,10 @@ array_creation_expression $$ = new ArrayCreation ((FullNamedExpression) $2, (List) $4, new ComposedTypeSpecifier (((List) $4).Count, GetLocation ($3)) { Next = (ComposedTypeSpecifier) $6 - }, (ArrayInitializer) $7, GetLocation ($1)); + }, (ArrayInitializer) $7, GetLocation ($1)) { + NoEmptyInterpolation = true + }; + lbag.AddLocation ($$, GetLocation ($3), GetLocation ($5)); } | NEW new_expr_type rank_specifiers opt_array_initializer @@ -3914,7 +3935,9 @@ array_creation_expression if ($4 == null) report.Error (1586, GetLocation ($1), "Array creation must have array size or array initializer"); - $$ = new ArrayCreation ((FullNamedExpression) $2, (ComposedTypeSpecifier) $3, (ArrayInitializer) $4, GetLocation ($1)); + $$ = new ArrayCreation ((FullNamedExpression) $2, (ComposedTypeSpecifier) $3, (ArrayInitializer) $4, GetLocation ($1)) { + NoEmptyInterpolation = true + }; } | NEW rank_specifier array_initializer {