11<?xml version =" 1.0" encoding =" utf-16" ?>
2- <!-- Generated with EZOut 1.8.6 : Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
2+ <!-- Generated with EZOut 1.8.7 : Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
33<Types >
4+ <Type >
5+ <Name >System.Management.Automation.Language.Ast</Name >
6+ <Members >
7+ <ScriptMethod >
8+ <Name >ConvertFromAST</Name >
9+ <Script >
10+ param()
11+
12+ return $this
13+
14+ </Script >
15+ </ScriptMethod >
16+ <ScriptMethod >
17+ <Name >GetLineage</Name >
18+ <Script >
19+ $thisParent = $this.Parent
20+ while ($thisParent) {
21+ $thisParent
22+ $thisParent = $thisParent.Parent
23+ }
24+
25+ </Script >
26+ </ScriptMethod >
27+ </Members >
28+ </Type >
29+ <Type >
30+ <Name >System.Management.Automation.Language.AttributeAst</Name >
31+ <Members >
32+ <ScriptProperty >
33+ <Name >ArgumentList</Name >
34+ <GetScriptBlock >
35+ $Parameter = [Ordered]@{}
36+ $ArgumentList = @()
37+ # Collect all of the arguments of the attribute, in the order they were specified.
38+ $argsInOrder = @(
39+ @($this.PositionalArguments) + @($this.NamedArguments) |
40+ Sort-Object { $_.Extent.StartOffset}
41+ )
42+
43+
44+ # Now we need to map each of those arguments into either named or positional arguments.
45+ foreach ($attributeArg in $argsInOrder) {
46+ # Named arguments are fairly straightforward:
47+ if ($attributeArg -is [Management.Automation.Language.NamedAttributeArgumentAst]) {
48+ $argName = $attributeArg.ArgumentName
49+ $argAst = $attributeArg.Argument
50+ $parameter[$argName] =
51+ if ($argName -eq $argAst) { # If the argument is the name,
52+ $true # treat it as a [switch] parameter.
53+ }
54+ # If the argument value was an ScriptBlockExpression
55+ else {
56+ $argAst
57+ }
58+ } else {
59+ # If we are a positional parameter, for the moment:
60+ if ($parameter.Count) {
61+ # add it to the last named parameter.
62+ $parameter[@($parameter.Keys)[-1]] =
63+ @() + $parameter[@($parameter.Keys)[-1]] + $argAst
64+ } else {
65+ # Or add it to the list of string arguments.
66+ $ArgumentList +=
67+ $attributeArg.ConvertFromAst()
68+ }
69+ }
70+ }
71+
72+ return $ArgumentList
73+
74+ </GetScriptBlock >
75+ </ScriptProperty >
76+ <ScriptProperty >
77+ <Name >Parameter</Name >
78+ <GetScriptBlock >
79+ $Parameter = [Ordered]@{}
80+ # Collect all of the arguments of the attribute, in the order they were specified.
81+ $argsInOrder = @(
82+ @($this.PositionalArguments) + @($this.NamedArguments) |
83+ Sort-Object { $_.Extent.StartOffset}
84+ )
85+
86+ # Now we need to map each of those arguments into either named or positional arguments.
87+ foreach ($attributeArg in $argsInOrder) {
88+ # Named arguments are fairly straightforward:
89+ if ($attributeArg -is [Management.Automation.Language.NamedAttributeArgumentAst]) {
90+ $argName = $attributeArg.ArgumentName
91+ $argAst = $attributeArg.Argument
92+ $parameter[$argName] =
93+ if ($argName -eq $argAst) { # If the argument is the name,
94+ $true # treat it as a [switch] parameter.
95+ }
96+ # If the argument value was an ScriptBlockExpression
97+ else {
98+ $argAst.ConvertFromAst()
99+ }
100+ } else {
101+ # If we are a positional parameter, for the moment:
102+ if ($parameter.Count) {
103+ # add it to the last named parameter.
104+ $parameter[@($parameter.Keys)[-1]] =
105+ @() + $parameter[@($parameter.Keys)[-1]] + $attributeArg.ConvertFromAst()
106+ }
107+ }
108+ }
109+
110+ return $Parameter
111+ </GetScriptBlock >
112+ </ScriptProperty >
113+ </Members >
114+ </Type >
115+ <Type >
116+ <Name >System.Management.Automation.Language.CommandAst</Name >
117+ <Members >
118+ <ScriptProperty >
119+ <Name >ArgumentList</Name >
120+ <GetScriptBlock >
121+ $parameterAstType = [Management.Automation.Language.CommandParameterAst]
122+ @(
123+ for (
124+ $commandElementIndex = 1
125+ $commandElementIndex -lt $this.CommandElements.Count
126+ $commandElementIndex++
127+ )
128+ {
129+ $commandElement = $this.CommandElements[$commandElementIndex]
130+ $nextElement = $this.CommandElements[$commandElementIndex + 1]
131+ if ($commandElement -is $parameterAstType) {
132+ if (-not $commandElement.Argument -and
133+ $nextElement -and
134+ $nextElement -isnot $parameterAstType) {
135+ $commandElementIndex++
136+ }
137+ } else {
138+ $commandElement.ConvertFromAst()
139+ }
140+ }
141+ )
142+ </GetScriptBlock >
143+ </ScriptProperty >
144+ <ScriptProperty >
145+ <Name >IsPiped</Name >
146+ <GetScriptBlock >
147+ ($this.Parent -is [Management.Automation.Language.PipelineAst]) -and
148+ ($this.Parent.PipelineElements.Count -gt 1)
149+
150+ </GetScriptBlock >
151+ </ScriptProperty >
152+ <ScriptProperty >
153+ <Name >Parameter</Name >
154+ <GetScriptBlock >
155+ $NamedParameters = [Ordered]@{}
156+ $parameterAstType = [Management.Automation.Language.CommandParameterAst]
157+
158+ for (
159+ $commandElementIndex = 1
160+ $commandElementIndex -lt $this.CommandElements.Count
161+ $commandElementIndex++
162+ )
163+ {
164+ $commandElement = $this.CommandElements[$commandElementIndex]
165+ $nextElement = $this.CommandElements[$commandElementIndex + 1]
166+ if ($commandElement -is $parameterAstType) {
167+ if ($commandElement.Argument) {
168+ $NamedParameters[$commandElement.ParameterName] =
169+ $commandElement.Argument.ConvertFromAst()
170+ } elseif ($nextElement -and $nextElement -isnot $parameterAstType) {
171+ $NamedParameters[$commandElement.ParameterName] =
172+ $nextElement.Argument.ConvertFromAst()
173+ $commandElementIndex++
174+ } else {
175+ $NamedParameters[$commandElement.ParameterName] = $true
176+ }
177+ }
178+ }
179+
180+ $NamedParameters
181+ </GetScriptBlock >
182+ </ScriptProperty >
183+ <ScriptProperty >
184+ <Name >PipelineLength</Name >
185+ <GetScriptBlock >
186+ if ($this.Parent -isnot [Management.Automation.Language.PipelineAst]) { return $null }
187+ $this.Parent.PipelineElements.Count
188+
189+
190+
191+ </GetScriptBlock >
192+ </ScriptProperty >
193+ <ScriptProperty >
194+ <Name >PipelinePosition</Name >
195+ <GetScriptBlock >
196+ if ($this.Parent -isnot [Management.Automation.Language.PipelineAst]) { return $null }
197+ $this.Parent.PipelineElements.IndexOf($this)
198+
199+
200+ </GetScriptBlock >
201+ </ScriptProperty >
202+ </Members >
203+ </Type >
204+ <Type >
205+ <Name >System.Management.Automation.Language.ConstantExpressionAst</Name >
206+ <Members >
207+ <ScriptMethod >
208+ <Name >ConvertFromAST</Name >
209+ <Script >
210+ $this.Value
211+
212+ </Script >
213+ </ScriptMethod >
214+ </Members >
215+ </Type >
4216 <Type >
5217 <Name >PipeScript</Name >
6218 <Members >
@@ -24,4 +236,72 @@ else {
24236 </ScriptProperty >
25237 </Members >
26238 </Type >
239+ <Type >
240+ <Name >System.Management.Automation.ScriptBlock</Name >
241+ <Members >
242+ <ScriptMethod >
243+ <Name >Transpile</Name >
244+ <Script >
245+ $this | .> PipeScript
246+
247+ </Script >
248+ </ScriptMethod >
249+ </Members >
250+ </Type >
251+ <Type >
252+ <Name >System.Management.Automation.Language.ScriptBlockExpressionAst</Name >
253+ <Members >
254+ <ScriptMethod >
255+ <Name >ConvertFromAST</Name >
256+ <Script >
257+ $this.GetScriptBlock()
258+
259+ </Script >
260+ </ScriptMethod >
261+ <ScriptMethod >
262+ <Name >GetScriptBlock</Name >
263+ <Script >
264+ [ScriptBlock]::create($this -replace '^\{' -replace '\}$')
265+
266+ </Script >
267+ </ScriptMethod >
268+ </Members >
269+ </Type >
270+ <Type >
271+ <Name >System.Management.Automation.Language.ScriptBlockAst</Name >
272+ <Members >
273+ <ScriptMethod >
274+ <Name >ConvertFromAST</Name >
275+ <Script >
276+ $this.GetScriptBlock()
277+
278+ </Script >
279+ </ScriptMethod >
280+ <ScriptMethod >
281+ <Name >GetScriptBlock</Name >
282+ <Script >
283+ [ScriptBlock]::create($this -replace '^\{' -replace '\}$')
284+
285+ </Script >
286+ </ScriptMethod >
287+ </Members >
288+ </Type >
289+ <Type >
290+ <Name >System.Management.Automation.Language.VariableExpressionAst</Name >
291+ <Members >
292+ <ScriptMethod >
293+ <Name >ConvertFromAST</Name >
294+ <Script >
295+ # Most variables we will not know the value of until we have run.
296+ # the exceptions to the rule are: $true, $false, and $null
297+ if ($this.variablePath.userPath -in 'true', 'false', 'null') {
298+ $ExecutionContext.SessionState.PSVariable.Get($this.variablePath).Value
299+ } else {
300+ $this
301+ }
302+
303+ </Script >
304+ </ScriptMethod >
305+ </Members >
306+ </Type >
27307</Types >
0 commit comments