Skip to content

Commit 470311b

Browse files
author
Kapil Borle
committed
Update range processing algorithm
1 parent 016f0d4 commit 470311b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Engine/Commands/InvokeFormatterCommand.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class InvokeFormatterCommand : PSCmdlet, IOutputWriter
4848
[Parameter(Mandatory = false)]
4949
[ValidateNotNull]
5050
public object Range { get; set; }
51+
5152
#if DEBUG
5253
/// <summary>
5354
/// Attaches to an instance of a .Net debugger
@@ -80,7 +81,7 @@ protected override void BeginProcessing()
8081

8182
try
8283
{
83-
range = GetRange();
84+
SetRange();
8485
}
8586
catch (Exception e)
8687
{
@@ -124,17 +125,19 @@ protected override void ProcessRecord()
124125
this.WriteObject(formattedScriptDefinition);
125126
}
126127

127-
private Range GetRange()
128+
private void SetRange()
128129
{
129130
if (Range == null)
130131
{
131-
return null;
132+
this.range = null;
133+
return;
132134
}
133135

134136
var range = Range as Range;
135137
if (range != null)
136138
{
137-
return range;
139+
this.range = range;
140+
return;
138141
}
139142

140143
var objArr = Range as object[];
@@ -167,7 +170,7 @@ private Range GetRange()
167170

168171
intArr = new int[objArr.Length];
169172
objArr.CopyTo(intArr, 0);
170-
return new Range(intArr[0], intArr[1], intArr[2], intArr[3]);
173+
this.range = new Range(intArr[0], intArr[1], intArr[2], intArr[3]);
171174
}
172175

173176
private void ValidateInputSettings()

0 commit comments

Comments
 (0)