提交 d5ba2a94 编写于 作者: T Tomas Matousek

C# EnC: handle addition of indexer

上级 cddb13bf
...@@ -6881,6 +6881,16 @@ class SampleCollection<T> ...@@ -6881,6 +6881,16 @@ class SampleCollection<T>
Diagnostic(RudeEditKind.Delete, "public T this[int i]", CSharpFeaturesResources.IndexerSetter)); Diagnostic(RudeEditKind.Delete, "public T this[int i]", CSharpFeaturesResources.IndexerSetter));
} }
[Fact, WorkItem(1174850)]
public void Indexer_Insert()
{
var src1 = "struct C { }";
var src2 = "struct C { public int this[int x, int y] { get { return x + y; } } }";
var edits = GetTopEdits(src1, src2);
edits.VerifySemanticDiagnostics();
}
[WorkItem(1120407)] [WorkItem(1120407)]
[Fact] [Fact]
public void ConstField_Update() public void ConstField_Update()
......
...@@ -825,9 +825,10 @@ internal override SyntaxNode TryGetContainingTypeDeclaration(SyntaxNode memberDe ...@@ -825,9 +825,10 @@ internal override SyntaxNode TryGetContainingTypeDeclaration(SyntaxNode memberDe
return memberDeclaration.Parent.FirstAncestorOrSelf<TypeDeclarationSyntax>(); return memberDeclaration.Parent.FirstAncestorOrSelf<TypeDeclarationSyntax>();
} }
internal override bool HasBackingField(SyntaxNode propertyDeclaration) internal override bool HasBackingField(SyntaxNode propertyOrIndexerDeclaration)
{ {
return SyntaxUtilities.HasBackingField((PropertyDeclarationSyntax)propertyDeclaration); return propertyOrIndexerDeclaration.IsKind(SyntaxKind.PropertyDeclaration) &&
SyntaxUtilities.HasBackingField((PropertyDeclarationSyntax)propertyOrIndexerDeclaration);
} }
internal override bool IsDeclarationWithInitializer(SyntaxNode declaration) internal override bool IsDeclarationWithInitializer(SyntaxNode declaration)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册