Skip to content

Commit 6db0150

Browse files
author
James Brundage
committed
Updating until keyword (using AST ETS) (#146 #145)
1 parent 87f6cf0 commit 6db0150

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Transpilers/Keywords/Until.psx.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ process {
6161
if (-not $firstArg -or $firstArg.GetType().Name -notin
6262
'ParenExpressionAst', 'ScriptBlockExpressionAst',
6363
'VariableExpressionAst','MemberExpressionAst','ExpandableStringExpressionAst') {
64-
Write-Error "Until must be followed by a Variable, Member, String, or Parenthesis Expression"
64+
Write-Error "Until must be followed by a Variable, Member, ExpandableString, or Parenthesis Expression"
6565
return
6666
}
6767

68-
if ($secondArg -isnot [Management.Automation.Language.ScriptBlockExpressionAst]) {
68+
if ($secondArg -isnot [Scriptblock]) {
6969
Write-Error "Until must be followed by a condition and a ScriptBlock"
7070
return
7171
}
@@ -83,7 +83,7 @@ process {
8383
}
8484

8585
$conditionScript = [ScriptBlock]::Create($condition)
86-
$LoopScript = $secondArg.Extent.ToString() -replace '^\{' -replace '\}$'
86+
$LoopScript = $secondArg
8787

8888
$secondArgScriptBlock = [ScriptBlock]::Create($LoopScript)
8989

0 commit comments

Comments
 (0)