提交 ed8963cf 编写于 作者: C CyrusNajmabadi

Support partial methods properly.

上级 d99d31ab
......@@ -50,6 +50,7 @@ struct NestedStruct { }
void M1() { }
public void M2() { }
void I.M3() { }
partial void M4() { }
int P1 { get; }
public int P2 { get; }
......@@ -107,6 +108,7 @@ private struct NestedStruct { }
private void M1() { }
public void M2() { }
void I.M3() { }
partial void M4() { }
private int P1 { get; }
public int P2 { get; }
......
......@@ -61,6 +61,9 @@ namespace N
public function M5() as integer
end function
partial sub M6()
end sub
property P1 as integer
property P2 as integer
......@@ -150,6 +153,9 @@ namespace N
public function M5() as integer
end function
Public partial sub M6()
end sub
Public property P1 as integer
Public property P2 as integer
......
......@@ -1444,7 +1444,20 @@ internal override bool CanHaveAccessibility(SyntaxNode declaration)
return ((IndexerDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
case SyntaxKind.MethodDeclaration:
return ((MethodDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
var method = (MethodDeclarationSyntax)declaration;
if (method.ExplicitInterfaceSpecifier != null)
{
// explicit interface methods can't have accessibility.
return false;
}
if (method.Modifiers.Any(SyntaxKind.PartialKeyword))
{
// partial methods can't have accessibility modifiers.
return false;
}
return true;
case SyntaxKind.EventDeclaration:
return ((EventDeclarationSyntax)declaration).ExplicitInterfaceSpecifier == null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册