Skip to content

Instantly share code, notes, and snippets.

@bielawb

bielawb/FuncDefinitionAST.ps1 Secret

Created Apr 11, 2021
Embed
What would you like to do?
Wyszukiwanie definicji funkcji za pomocą AST
$ast = [System.Management.Automation.Language.Parser]::ParseFile($Path, [ref]$null, [ref]$null)
$definicja = $ast.FindAll(
{
param ([System.Management.Automation.Language.Ast]$astElement)
$astElement -is [System.Management.Automation.Language.FunctionDefinitionAst] -and
$astElement.Name -eq $Name
},
$false
) | Select-Object -Last 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment