Partilhar via


ParameterAst Class

Definition

The ast representing a parameter to a script. Parameters may appear in one of 2 places, either just after the name of the function, e.g. function foo($a){} or in a param statement, e.g. param($a).

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

Constructors

ParameterAst(IScriptExtent, VariableExpressionAst, IEnumerable<AttributeBaseAst>, ExpressionAst)

Construct a parameter ast from the name, attributes, and default value.

Properties

Attributes

The asts for any attributes or type constraints specified on the parameter.

DefaultValue

The ast for the default value of the parameter, or null if no default value was specified.

Extent

The extent in the source this ast represents.

(Inherited from Ast)
Name

The variable path for the parameter. This property is never null.

Parent

The parent tree for this node.

(Inherited from Ast)
StaticType

Returns the type of the parameter. If the parameter is constrained to be a specific type, that type is returned, otherwise typeof(object) is returned.

Methods

Copy()

Copy the ParameterAst 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