Skip to content

Commit 37815ee

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.get/set_Steps performance ( Fixes #159 )
1 parent 8b8fe19 commit 37815ee

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

Turtle.types.ps1xml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3078,10 +3078,14 @@ $this.'.Stack'
30783078
<ScriptProperty>
30793079
<Name>Steps</Name>
30803080
<GetScriptBlock>
3081-
if ($this.'.Steps') {
3082-
return $this.'.Steps'
3081+
if (-not $this.'.Steps') {
3082+
$this.psobject.properties.add(
3083+
[psnoteproperty]::new(
3084+
'.Steps', [Collections.Generic.List[string]]::new()
3085+
), $false
3086+
)
30833087
}
3084-
return ,@()
3088+
return ,$this.'.Steps'
30853089

30863090
</GetScriptBlock>
30873091
<SetScriptBlock>
@@ -3098,7 +3102,14 @@ param(
30983102
$Steps
30993103
)
31003104

3101-
$this | Add-Member -MemberType NoteProperty -Force -Name '.Steps' -Value @($Steps)
3105+
if (-not $this.'.Steps') {
3106+
$this | Add-Member -MemberType NoteProperty -Force -Name '.Steps' -Value @(
3107+
[Collections.Generic.List[string]]::new($Steps)
3108+
)
3109+
} else {
3110+
$this.'.Steps' = $steps
3111+
}
3112+
31023113

31033114
</SetScriptBlock>
31043115
</ScriptProperty>

0 commit comments

Comments
 (0)