Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
[CodeAction] Fixed bug in create property code action.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrueger committed Oct 15, 2012
1 parent b1a5ccf commit e1760a5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Expand Up @@ -75,7 +75,9 @@ public IEnumerable<CodeAction> GetActions(RefactoringContext context)
} else {
if (state.CurrentMember == null)
yield break;
isStatic |= state.CurrentMember.IsStatic || state.CurrentTypeDefinition.IsStatic;
isStatic |= state.CurrentTypeDefinition.IsStatic;
if (targetResolveResult == null)
isStatic |= state.CurrentMember.IsStatic;
}

// var service = (NamingConventionService)context.GetService(typeof(NamingConventionService));
Expand Down
Expand Up @@ -307,5 +307,27 @@ void TestMethod ()
}
");
}

[Test()]
public void TestNonStaticPropertyInStaticMethod ()
{
TestCreateProperty (@"class TestClass
{
static void Foo ()
{
new TestClass ().$NonExistantProperty = 5;
}
}", @"class TestClass
{
int NonExistantProperty {
get;
set;
}
static void Foo ()
{
new TestClass ().NonExistantProperty = 5;
}
}");
}
}
}

0 comments on commit e1760a5

Please sign in to comment.