Add clean block to script block as a peer to begin, process, and end to allow easy resource cleanup (#15177)

This commit is contained in:
Dongbo Wang authored and GitHub committed 2021-10-11 14:49:09 -07:00
1 parent fa4bfb447e
commit a32700a1c1
30 files changed
+3055 -644

No files matched your search

@@ -945,25 +945,11 @@ namespace System.Management.Automation.Language
{
_currentBlock = _entryBlock;
if (scriptBlockAst.DynamicParamBlock != null)
{
scriptBlockAst.DynamicParamBlock.Accept(this);
}
if (scriptBlockAst.BeginBlock != null)
{
scriptBlockAst.BeginBlock.Accept(this);
}
if (scriptBlockAst.ProcessBlock != null)
{
scriptBlockAst.ProcessBlock.Accept(this);
}
if (scriptBlockAst.EndBlock != null)
{
scriptBlockAst.EndBlock.Accept(this);
}
scriptBlockAst.DynamicParamBlock?.Accept(this);
scriptBlockAst.BeginBlock?.Accept(this);
scriptBlockAst.ProcessBlock?.Accept(this);
scriptBlockAst.EndBlock?.Accept(this);
scriptBlockAst.CleanBlock?.Accept(this);
_currentBlock.FlowsTo(_exitBlock);