Skip to content

Commit 3e411f4

Browse files
StartAutomatingStartAutomating
authored andcommitted
ParameterAst. Adding .ParameterNames (re #305)
1 parent f18cbd4 commit 3e411f4

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

PipeScript.types.ps1xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,10 @@ $this.Parent.Extent.ToString().Substring(0, $offsetDifference) -replace '^[\r\n\
892892
<Type>
893893
<Name>System.Management.Automation.Language.ParameterAST</Name>
894894
<Members>
895+
<AliasProperty>
896+
<Name>Aliases</Name>
897+
<ReferencedMemberName>ParameterNames</ReferencedMemberName>
898+
</AliasProperty>
895899
<AliasProperty>
896900
<Name>FriendlyName</Name>
897901
<ReferencedMemberName>DisplayName</ReferencedMemberName>
@@ -1086,6 +1090,29 @@ foreach ($attr in $this.Attributes) {
10861090
return $metadata
10871091
</GetScriptBlock>
10881092
</ScriptProperty>
1093+
<ScriptProperty>
1094+
<Name>ParameterNames</Name>
1095+
<GetScriptBlock>
1096+
@(foreach ($attr in $this.Attributes) {
1097+
$reflectedType = $attr.TypeName.GetReflectionType()
1098+
if ($reflectedType -ne [Alias]) {
1099+
continue
1100+
}
1101+
1102+
foreach ($positionalParameter in $attr.PositionalArguments) {
1103+
$positionalParameter.Value
1104+
}
1105+
1106+
foreach ($namedArgument in $attr.NamedArguments) {
1107+
if ($namedArgument.ArgumentName -eq 'AliasNames') {
1108+
$namedArgument.Argument.Value
1109+
}
1110+
}
1111+
}
1112+
1113+
$this.Name.VariablePath.ToString())
1114+
</GetScriptBlock>
1115+
</ScriptProperty>
10891116
<ScriptProperty>
10901117
<Name>ParameterSets</Name>
10911118
<GetScriptBlock>

0 commit comments

Comments
 (0)