Skip to content

Commit e731074

Browse files
committed
Remove the check for ScritpBlock in PositionalParameter
1 parent a05dbae commit e731074

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

Engine/Helper.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ public bool PositionalParameterUsed(CommandAst cmdAst)
249249
CommandInfo commandInfo = GetCommandInfo(GetCmdletNameFromAlias(cmdAst.GetCommandName())) ?? GetCommandInfo(cmdAst.GetCommandName());
250250

251251
IEnumerable<ParameterMetadata> switchParams = null;
252-
IEnumerable<CommandParameterSetInfo> scriptBlocks = null;
253-
bool hasScriptBlockSet = false;
254252

255253
if (HasSplattedVariable(cmdAst))
256254
{
@@ -262,15 +260,6 @@ public bool PositionalParameterUsed(CommandAst cmdAst)
262260
try
263261
{
264262
switchParams = commandInfo.Parameters.Values.Where<ParameterMetadata>(pm => pm.SwitchParameter);
265-
scriptBlocks = commandInfo.ParameterSets;
266-
foreach (CommandParameterSetInfo cmdParaset in scriptBlocks)
267-
{
268-
if (String.Equals(cmdParaset.Name, "ScriptBlockSet", StringComparison.OrdinalIgnoreCase))
269-
{
270-
hasScriptBlockSet = true;
271-
}
272-
}
273-
274263
}
275264
catch (Exception)
276265
{
@@ -284,8 +273,6 @@ public bool PositionalParameterUsed(CommandAst cmdAst)
284273

285274
foreach (CommandElementAst ceAst in cmdAst.CommandElements)
286275
{
287-
if (!hasScriptBlockSet)
288-
{
289276
if (ceAst is CommandParameterAst)
290277
{
291278
// Skip if it's a switch parameter
@@ -308,7 +295,7 @@ public bool PositionalParameterUsed(CommandAst cmdAst)
308295
{
309296
arguments += 1;
310297
}
311-
}
298+
312299
}
313300

314301
// if not the first element in a pipeline, increase the number of arguments by 1

0 commit comments

Comments
 (0)