Skip to content

Instantly share code, notes, and snippets.

@bielawb
Created April 11, 2021 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bielawb/42b98f4e84aa973a9fd15066a1582efc to your computer and use it in GitHub Desktop.
Save bielawb/42b98f4e84aa973a9fd15066a1582efc to your computer and use it in GitHub Desktop.
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