提交 fe241769 编写于 作者: B BalajiKris

Bug Fix 933972 : Recommend ref/out keywords in Constructor Initializers (changeset 1264369)

上级 b37d0039
......@@ -441,6 +441,10 @@ public static bool IsConstructorOrMethodParameterArgumentContext(this SyntaxToke
// new Foo( |
// new Foo(expr, |
// new Foo(bar: |
// Foo : base( |
// Foo : base(bar: |
// Foo : this( |
// Foo : ths(bar: |
// Foo(bar: |
if (targetToken.CSharpKind() == SyntaxKind.ColonToken &&
......@@ -450,7 +454,9 @@ public static bool IsConstructorOrMethodParameterArgumentContext(this SyntaxToke
{
var owner = targetToken.Parent.GetParent().GetParent().GetParent();
if (owner.IsKind(SyntaxKind.InvocationExpression) ||
owner.IsKind(SyntaxKind.ObjectCreationExpression))
owner.IsKind(SyntaxKind.ObjectCreationExpression) ||
owner.IsKind(SyntaxKind.BaseConstructorInitializer) ||
owner.IsKind(SyntaxKind.ThisConstructorInitializer))
{
return true;
}
......@@ -462,7 +468,9 @@ public static bool IsConstructorOrMethodParameterArgumentContext(this SyntaxToke
if (targetToken.IsParentKind(SyntaxKind.ArgumentList))
{
if (targetToken.Parent.IsParentKind(SyntaxKind.InvocationExpression) ||
targetToken.Parent.IsParentKind(SyntaxKind.ObjectCreationExpression))
targetToken.Parent.IsParentKind(SyntaxKind.ObjectCreationExpression) ||
targetToken.Parent.IsParentKind(SyntaxKind.BaseConstructorInitializer) ||
targetToken.Parent.IsParentKind(SyntaxKind.ThisConstructorInitializer))
{
return true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册