Skip to content

Commit ffadfe6

Browse files
Razmo99JustinGrote
authored andcommitted
additional condition so that a function CommandAst will not be touched if it exists before the functions definition
1 parent 6fcacce commit ffadfe6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PowerShellEditorServices/Services/PowerShell/Refactoring/IterativeFunctionVistor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ public void ProcessNode(Ast node, bool shouldRename)
171171
}
172172
break;
173173
case CommandAst ast:
174-
if (ast.GetCommandName()?.ToLower() == OldName.ToLower())
174+
if (ast.GetCommandName()?.ToLower() == OldName.ToLower() &&
175+
TargetFunctionAst.Extent.StartLineNumber <= ast.Extent.StartLineNumber)
175176
{
176177
if (shouldRename)
177178
{

0 commit comments

Comments
 (0)