Skip to content

Commit

Permalink
Merge branch 'fix-mcs-16997'
Browse files Browse the repository at this point in the history
  • Loading branch information
erik-kallen committed Jan 2, 2014
2 parents 90187ea + 6732d97 commit 9c668b5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6164,6 +6164,8 @@ void case_320()
void case_321()
#line 2666 "cs-parser.jay"
{
lexer.parsing_modifiers = true;

/* here will be evaluated after CLOSE_BLACE is consumed.*/
if (doc_support)
Lexer.doc_state = XmlCommentState.Allowed;
Expand Down
2 changes: 2 additions & 0 deletions ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay
Original file line number Diff line number Diff line change
Expand Up @@ -2664,6 +2664,8 @@ enum_declaration
}
opt_enum_member_declarations
{
lexer.parsing_modifiers = true;

// here will be evaluated after CLOSE_BLACE is consumed.
if (doc_support)
Lexer.doc_state = XmlCommentState.Allowed;
Expand Down
17 changes: 17 additions & 0 deletions ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,23 @@ protected override void UpdateSourceProperties (string targetBasePath)

}

[Test]
public void AsyncAfterEnum() {
string code = @"
using System.Threading.Tasks;
class C
{
enum E {}
async Task M() {
}
}";

var unit = SyntaxTree.Parse(code);
var type = unit.Members.OfType<TypeDeclaration>().Single();
var member = type.Members.OfType<MethodDeclaration>().SingleOrDefault(m => m.Name == "M");
Assert.IsNotNull(member, "M() not found.");
Assert.That(member.Modifiers, Is.EqualTo(Modifiers.Async));
}
}
}

0 comments on commit 9c668b5

Please sign in to comment.