File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ $validateScripts = @(
6969 if ($DataLanguage ) {
7070@'
7171[ValidateScript({
72+ if ($_ -isnot [ScriptBlock]) { return $true }
7273 $sbCopy = "data { $_ }"
7374 try {
7475 $dataOutput = & ([ScriptBlock]::Create($sbCopy))
@@ -82,6 +83,7 @@ $validateScripts = @(
8283 if ($ParameterOnly ) {
8384@'
8485[ValidateScript({
86+ if ($_ -isnot [ScriptBlock]) { return $true }
8587 $statementCount = 0
8688 $statementCount += $_.Ast.DynamicParamBlock.Statements.Count
8789 $statementCount += $_.Ast.BeginBlock.Statements.Count
@@ -98,6 +100,7 @@ $validateScripts = @(
98100 if ($NoBlock ) {
99101@'
100102[ValidateScript({
103+ if ($_ -isnot [ScriptBlock]) { return $true }
101104 if ($_.Ast.DynamicParamBlock -or $_.Ast.BeginBlock -or $_.Ast.ProcessBlock) {
102105 throw "ScriptBlock should not have any named blocks"
103106 }
@@ -108,6 +111,7 @@ $validateScripts = @(
108111 if ($NoParameter ) {
109112@'
110113[ValidateScript({
114+ if ($_ -isnot [ScriptBlock]) { return $true }
111115 if ($_.Ast.ParamBlock.Parameters.Count) {
112116 throw "ScriptBlock should not have parameters"
113117 }
You can’t perform that action at this time.
0 commit comments