File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 1- [Alias (' PSTypeName' , ' Management.Automation.PSTypeName' , ' System.Management.Automation.PSTypeName' )]
2- [CmdletBinding (DefaultParameterSetName = ' ScriptBlock' )]
1+ <#
2+ . SYNOPSIS
3+ decorate transpiler
4+ . DESCRIPTION
5+ Applies one or more typenames to an object.
6+ By 'decorating' the object with a typename, this enables use of the extended type system.
7+ . EXAMPLE
8+ {
9+ $v = [PSCustomObject]@{}
10+ [decorate('MyTypeName',Clear,PassThru)]$v
11+ }.Transpile()
12+ #>
13+ [Alias (' PSTypeName' , ' Management.Automation.PSTypeName' , ' System.Management.Automation.PSTypeName' )]
314param (
415# The variable decoration will be applied to.
5- [Parameter (Mandatory = $true , ParameterSetName = ' VariableAST' , ValueFromPipeline )]
16+ [Parameter (Mandatory , ParameterSetName = ' VariableAST' , ValueFromPipeline )]
617[Management.Automation.Language.VariableExpressionast ]
718$VariableAst ,
819
@@ -31,7 +42,7 @@ process {
3142 if ($clear ) {
3243 $variableText + " .pstypenames.clear()"
3344 }
34- foreach ($tn in $PSTypeName ) {
45+ foreach ($tn in $TypeName ) {
3546 $stn = $tn.Replace (" '" , " ''" )
3647 $variableText + " .pstypenames.add('$stn ')"
3748 }
You can’t perform that action at this time.
0 commit comments