提交 48f180da 编写于 作者: O Omar Tawfik

clean up

上级 605886a5
......@@ -5895,11 +5895,6 @@ private ScanTypeFlags ScanNonArrayType(ParseTypeMode mode, out SyntaxToken lastT
this.EatToken();
}
}
else if (this.CurrentToken.Kind == SyntaxKind.InKeyword)
{
// Start of a lambda parameter
this.EatToken();
}
if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken)
{
......@@ -9815,6 +9810,7 @@ private bool ScanExplicitlyTypedLambda(Precedence precedence)
}
break;
case SyntaxKind.OutKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.ParamsKeyword:
this.EatToken();
foundParameterModifier = true;
......
......@@ -422,5 +422,14 @@ class Program
public $$ int Test { get; set; }
}");
}
[Test.Utilities.CompilerTrait(Test.Utilities.CompilerFeature.ReadOnlyReferences)]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterThis()
{
await VerifyAbsenceAsync(
@"static class C {
static void Goo(this $$");
}
}
}
......@@ -120,6 +120,14 @@ public async Task TestNotAfterRef()
void Goo(ref $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterIn()
{
await VerifyAbsenceAsync(
@"class C {
void Goo(in $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterThis_InBogusMethod()
{
......@@ -647,7 +655,22 @@ public static class Extensions
public static void Extension(ref $$ object obj, int x) { }
}");
}
[Fact]
public async Task TestExtensionMethods_FirstParameter_AfterInKeyword_InClass()
{
await VerifyKeywordAsync(@"
public static class Extensions
{
public static void Extension(in $$");
await VerifyKeywordAsync(@"
public static class Extensions
{
public static void Extension(in $$ object obj, int x) { }
}");
}
[Fact]
public async Task TestExtensionMethods_SecondParameter_AfterRefKeyword_InClass()
{
......@@ -664,17 +687,17 @@ public static class Extensions
}
[Fact]
public async Task TestExtensionMethods_SecondParameter_AfterRefReadonlyKeywords_InClass()
public async Task TestExtensionMethods_SecondParameter_AfterInKeywords_InClass()
{
await VerifyAbsenceAsync(@"
public static class Extensions
{
public static void Extension(int x, ref readonly $$");
public static void Extension(int x, in $$");
await VerifyAbsenceAsync(@"
public static class Extensions
{
public static void Extension(int x, ref readonly $$ object obj) { }
public static void Extension(int x, in $$ object obj) { }
}");
}
......@@ -687,11 +710,11 @@ public async Task TestExtensionMethods_FirstParameter_AfterRefKeyword_OutsideCla
}
[Fact]
public async Task TestExtensionMethods_FirstParameter_AfterRefReadOnlyKeywords_OutsideClass()
public async Task TestExtensionMethods_FirstParameter_AfterInKeywords_OutsideClass()
{
await VerifyAbsenceAsync("public static void Extension(ref readonly $$");
await VerifyAbsenceAsync("public static void Extension(in $$");
await VerifyAbsenceAsync("public static void Extension(ref readonly $$ object obj, int x) { }");
await VerifyAbsenceAsync("public static void Extension(in $$ object obj, int x) { }");
}
[Fact]
......@@ -710,17 +733,17 @@ public class Extensions
}
[Fact]
public async Task TestExtensionMethods_FirstParameter_AfterRefReadOnlyKeywords_NonStaticClass()
public async Task TestExtensionMethods_FirstParameter_AfterInKeywords_NonStaticClass()
{
await VerifyAbsenceAsync(@"
public class Extensions
{
public static void Extension(ref readonly $$");
public static void Extension(in $$");
await VerifyAbsenceAsync(@"
public class Extensions
{
public static void Extension(ref readonly $$ object obj, int x) { }
public static void Extension(in $$ object obj, int x) { }
}");
}
......@@ -740,17 +763,17 @@ public static class Extensions
}
[Fact]
public async Task TestExtensionMethods_FirstParameter_AfterRefReadOnlyKeywords_NonStaticMethod()
public async Task TestExtensionMethods_FirstParameter_AfterInKeywords_NonStaticMethod()
{
await VerifyAbsenceAsync(@"
public static class Extensions
{
public void Extension(ref readonly $$");
public void Extension(in $$");
await VerifyAbsenceAsync(@"
public static class Extensions
{
public void Extension(ref readonly $$ object obj, int x) { }
public void Extension(in $$ object obj, int x) { }
}");
}
}
......
......@@ -1025,7 +1025,7 @@ public static bool IsDefaultExpressionContext(this SyntaxTree syntaxTree, int po
}
if (isThisKeyword &&
token.IsKind(SyntaxKind.RefKeyword) &&
(token.IsKind(SyntaxKind.RefKeyword) || token.IsKind(SyntaxKind.InKeyword)) &&
token.Parent.GetParent().IsDelegateOrConstructorOrLocalFunctionOrMethodParameterList())
{
var parameter = token.GetAncestor<ParameterSyntax>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册