다음을 통해 공유


FunctionDefinitionAst Class

Definition

The ast that represents a function or filter definition. The function is always named.

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

Constructors

FunctionDefinitionAst(IScriptExtent, Boolean, Boolean, String, IEnumerable<ParameterAst>, ScriptBlockAst)

Construct a function definition.

Properties

Body

The body of the function. This property is never null.

Extent

The extent in the source this ast represents.

(Inherited from Ast)
IsFilter

If true, the filter keyword was used.

IsWorkflow

If true, the workflow keyword was used.

Name

The name of the function or filter. This property is never null or empty.

Parameters

The parameters specified immediately after the function name, or null if no parameters were specified.

It is possible that this property may have a value and ParamBlock to also have a value. Normally this is not allowed in a valid script, but in one rare case it is allowed:

function foo() { param($a) }

In this example, the parameters specified after the function name must be empty or the script is not valid.

Parent

The parent tree for this node.

(Inherited from Ast)

Methods

Copy()

Copy the FunctionDefinitionAst 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 function.

GetHelpContent(Dictionary<Ast,Token[]>)

Return the help content, if any, for the function. Use this overload when parsing multiple functions within a single scope.

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