Compartilhar via


CommandParameterAst Class

Definition

The ast that represents a parameter to a command, e.g. dir -Path a*, this class represent '-Path', and in dir -Path:a*, this class represents '-Path:a*'.

In the first case, the argument 'a*' is not represented by this class because the parser can't know until runtime if the argument is positional or if -Path accepts an argument. In the later case, the argument 'a*' always belongs to the parameter -Path.

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

Constructors

CommandParameterAst(IScriptExtent, String, ExpressionAst, IScriptExtent)

Construct a command parameter.

Properties

Argument

The ast for the argument if specified (e.g. -Path:-abc, then the argument is the ast for '-ast'), otherwise null if no argument was specified.

ErrorPosition

The error position to use when parameter binding fails. This extent does not include the argument if one was specified, which means this extent is often the same as Extent.

Extent

The extent in the source this ast represents.

(Inherited from Ast)
ParameterName

The name of the parameter. This value does not include a leading dash, and in the case that an argument is specified, no trailing colon is included either. This property is never null or empty.

Parent

The parent tree for this node.

(Inherited from Ast)

Methods

Copy()

Copy the CommandParameterAst 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)
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