ScriptBlockAst Class

Definition

A ScriptBlockAst is the root ast node for a complete script.

public ref class ScriptBlockAst : System::Management::Automation::Language::Ast
public class ScriptBlockAst : System.Management.Automation.Language.Ast
type ScriptBlockAst = class
    inherit Ast
Public Class ScriptBlockAst
Inherits Ast
Inheritance
ScriptBlockAst

Constructors

ScriptBlockAst(IScriptExtent, IEnumerable<AttributeAst>, ParamBlockAst, StatementBlockAst, Boolean, Boolean)

Construct a ScriptBlockAst that does not use explicitly named blocks.

ScriptBlockAst(IScriptExtent, IEnumerable<UsingStatementAst>, IEnumerable<AttributeAst>, ParamBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst)

Construct a ScriptBlockAst that uses explicitly named begin/process/end blocks.

ScriptBlockAst(IScriptExtent, IEnumerable<UsingStatementAst>, IEnumerable<AttributeAst>, ParamBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst)

Initializes a new instance of the ScriptBlockAst class. This construction uses explicitly named begin/process/end/clean blocks.

ScriptBlockAst(IScriptExtent, IEnumerable<UsingStatementAst>, IEnumerable<AttributeAst>, ParamBlockAst, StatementBlockAst, Boolean, Boolean)

Construct a ScriptBlockAst that does not use explicitly named blocks.

ScriptBlockAst(IScriptExtent, IEnumerable<UsingStatementAst>, ParamBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst)

Construct a ScriptBlockAst that uses explicitly named begin/process/end blocks.

ScriptBlockAst(IScriptExtent, IEnumerable<UsingStatementAst>, ParamBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst)

Initializes a new instance of the ScriptBlockAst class. This construction uses explicitly named begin/process/end/clean blocks.

ScriptBlockAst(IScriptExtent, IEnumerable<UsingStatementAst>, ParamBlockAst, StatementBlockAst, Boolean, Boolean)

Construct a ScriptBlockAst that does not use explicitly named blocks.

ScriptBlockAst(IScriptExtent, List<UsingStatementAst>, ParamBlockAst, StatementBlockAst, Boolean)

Construct a ScriptBlockAst that does not use explicitly named blocks.

ScriptBlockAst(IScriptExtent, ParamBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst)

Construct a ScriptBlockAst that uses explicitly named begin/process/end blocks.

ScriptBlockAst(IScriptExtent, ParamBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst, NamedBlockAst)

Initializes a new instance of the ScriptBlockAst class. This construction uses explicitly named begin/process/end/clean blocks.

ScriptBlockAst(IScriptExtent, ParamBlockAst, StatementBlockAst, Boolean)

Construct a ScriptBlockAst that does not use explicitly named blocks.

ScriptBlockAst(IScriptExtent, ParamBlockAst, StatementBlockAst, Boolean, Boolean)

Construct a ScriptBlockAst that does not use explicitly named blocks.

Properties

Attributes

The asts for attributes (such as [DscLocalConfigurationManager()]) used before the scriptblock. This property is never null.

BeginBlock

The ast representing the begin block for a script block, or null if no begin block was specified.

CleanBlock

Gets the ast representing the clean block for a script block, or null if no clean block was specified.

DynamicParamBlock

The ast representing the dynamicparam block for a script block, or null if no dynamicparam block was specified.

EndBlock

The ast representing the end block for a script block, or null if no end block was specified.

Extent

The extent in the source this ast represents.

(Inherited from Ast)
ParamBlock

The ast representing the parameters for a script block, or null if no param block was specified.

Parent

The parent tree for this node.

(Inherited from Ast)
ProcessBlock

The ast representing the process block for a script block, or null if no process block was specified.

ScriptRequirements

All of the parsed information from any #requires in the script, or null if #requires was not used. This property is only set for the top level script block (where Parent) is null.

UsingStatements

The asts for any using statements. This property is never null. Elements of the collection are instances of either UsingStatementAst or (only in error cases) ErrorStatementAst.

Methods

Copy()

Copy the ScriptBlockAst instance.

Find(Func<Ast,Boolean>, Boolean)

Traverse the entire Ast, returning the first node in the tree for which predicate returns true.

(Inherited from Ast)
FindAll(Func<Ast,Boolean>, Boolean)

Traverse the entire Ast, returning all nodes in the tree for which predicate returns true.

(Inherited from Ast)
GetHelpContent()

Return the help content, if any, for the script block.

GetScriptBlock()

Convert the ast into a script block that can be invoked.

SafeGetValue()

Constructs the resultant object from the AST and returns it if it is safe.

(Inherited from Ast)
SafeGetValue(Boolean)

Constructs the resultant object from the AST and returns it if it is safe.

(Inherited from Ast)
ToString()

Formats the ast and returns a string.

(Inherited from Ast)
Visit(AstVisitor)

Visit each node in the Ast, calling the methods in astVisitor for each node in the ast.

(Inherited from Ast)
Visit(ICustomAstVisitor)

Visit the Ast using a visitor that can choose how the tree traversal is performed. This visit method is for advanced uses of the visitor pattern where an AstVisitor is insufficient.

(Inherited from Ast)

Applies to