C# 클래스 Rhino.Ast.FunctionNode

A JavaScript function declaration or expression.

Node type is Rhino.Token.FUNCTION .

FunctionDeclaration : function Identifier ( FormalParameterListopt ) { FunctionBody } FunctionExpression : function Identifieropt ( FormalParameterListopt ) { FunctionBody } FormalParameterList : Identifier FormalParameterList , Identifier FunctionBody : SourceElements Program : SourceElements SourceElements : SourceElement SourceElements SourceElement SourceElement : Statement FunctionDeclaration
JavaScript 1.8 introduces "function closures" of the form
function ([params] ) Expression
In this case the FunctionNode node will have no body but will have an expression.
상속: ScriptNode
파일 보기 프로젝트 열기: hazzik/Rhino.Net 1 사용 예제들

공개 메소드들

메소드 설명
AddFunction ( Rhino fnNode ) : int
AddLiveLocals ( Node node, int locals ) : void
AddParam ( AstNode param ) : void

Adds a parameter to the function parameter list.

Adds a parameter to the function parameter list. Sets the parent of the param node to this node.

AddResumptionPoint ( Node target ) : void
FunctionNode ( ) : System.Collections.Generic
FunctionNode ( int pos ) : System.Collections.Generic
FunctionNode ( int pos, Name name ) : System.Collections.Generic
GetBody ( ) : AstNode

Returns function body.

Returns function body. Normally a Block , but can be a plain AstNode if it's a function closure.

GetFunctionName ( ) : Name

Returns function name

GetFunctionType ( ) : int

Returns the function type (statement, expr, statement expr)

GetLiveLocals ( ) : int[]>.IDictionary
GetLp ( ) : int

Returns left paren position, -1 if missing

GetMemberExprNode ( ) : AstNode
GetName ( ) : string

Returns the function name as a string

GetParams ( ) : IList

Returns the function parameter list

GetResumptionPoints ( ) : IList
GetRp ( ) : int

Returns right paren position, -1 if missing

IsExpressionClosure ( ) : bool

Returns whether this is a 1.8 function closure

IsGenerator ( ) : bool
IsGetter ( ) : bool
IsGetterOrSetter ( ) : bool
IsParam ( AstNode node ) : bool

Returns true if the specified AstNode node is a parameter of this Function node. This provides a way during AST traversal to disambiguate the function name node from the parameter nodes.

IsSetter ( ) : bool
RequiresActivation ( ) : bool

Return true if this function requires an Ecma-262 Activation object.

Return true if this function requires an Ecma-262 Activation object. The Activation object is implemented by Rhino.NativeCall , and is fairly expensive to create, so when possible, the interpreter attempts to use a plain call frame instead.

SetBody ( AstNode body ) : void

Sets function body, and sets its parent to this node.

Sets function body, and sets its parent to this node. Also sets the encoded source bounds based on the body bounds. Assumes the function node absolute position has already been set, and the body node's absolute position and length are set.

SetFunctionIsGetter ( ) : void
SetFunctionIsSetter ( ) : void
SetFunctionName ( Name name ) : void

Sets function name, and sets its parent to this node.

Sets function name, and sets its parent to this node.

SetFunctionType ( int type ) : void
SetIsExpressionClosure ( bool isExpressionClosure ) : void

Sets whether this is a 1.8 function closure

SetIsGenerator ( ) : void
SetLp ( int lp ) : void

Sets left paren position

SetMemberExprNode ( AstNode node ) : void

Rhino supports a nonstandard Ecma extension that allows you to say, for instance, function a.b.c(arg1, arg) {...}, and it will be rewritten at codegen time to: a.b.c = function(arg1, arg2) {...} If we detect an expression other than a simple Name in the position where a function name was expected, we record that expression here.

Rhino supports a nonstandard Ecma extension that allows you to say, for instance, function a.b.c(arg1, arg) {...}, and it will be rewritten at codegen time to: a.b.c = function(arg1, arg2) {...} If we detect an expression other than a simple Name in the position where a function name was expected, we record that expression here.

This extension is only available by setting the CompilerEnv option "isAllowMemberExprAsFunctionName" in the Parser.

SetParams ( IList @params ) : void

Sets the function parameter list, and sets the parent for each element of the list.

Sets the function parameter list, and sets the parent for each element of the list.

SetParens ( int lp, int rp ) : void

Sets both paren positions

SetRequiresActivation ( ) : void
SetRp ( int rp ) : void

Sets right paren position

ToSource ( int depth ) : string
Visit ( NodeVisitor v ) : void

Visits this node, the function name node if supplied, the parameters, and the body.

Visits this node, the function name node if supplied, the parameters, and the body. If there is a member-expr node, it is visited last.

메소드 상세

AddFunction() 공개 메소드

public AddFunction ( Rhino fnNode ) : int
fnNode Rhino
리턴 int

AddLiveLocals() 공개 메소드

public AddLiveLocals ( Node node, int locals ) : void
node Node
locals int
리턴 void

AddParam() 공개 메소드

Adds a parameter to the function parameter list.
Adds a parameter to the function parameter list. Sets the parent of the param node to this node.
/// if param is /// null ///
public AddParam ( AstNode param ) : void
param AstNode the parameter
리턴 void

AddResumptionPoint() 공개 메소드

public AddResumptionPoint ( Node target ) : void
target Node
리턴 void

FunctionNode() 공개 메소드

public FunctionNode ( ) : System.Collections.Generic
리턴 System.Collections.Generic

FunctionNode() 공개 메소드

public FunctionNode ( int pos ) : System.Collections.Generic
pos int
리턴 System.Collections.Generic

FunctionNode() 공개 메소드

public FunctionNode ( int pos, Name name ) : System.Collections.Generic
pos int
name Name
리턴 System.Collections.Generic

GetBody() 공개 메소드

Returns function body.
Returns function body. Normally a Block , but can be a plain AstNode if it's a function closure.
public GetBody ( ) : AstNode
리턴 AstNode

GetFunctionName() 공개 메소드

Returns function name
public GetFunctionName ( ) : Name
리턴 Name

GetFunctionType() 공개 메소드

Returns the function type (statement, expr, statement expr)
public GetFunctionType ( ) : int
리턴 int

GetLiveLocals() 공개 메소드

public GetLiveLocals ( ) : int[]>.IDictionary
리턴 int[]>.IDictionary

GetLp() 공개 메소드

Returns left paren position, -1 if missing
public GetLp ( ) : int
리턴 int

GetMemberExprNode() 공개 메소드

public GetMemberExprNode ( ) : AstNode
리턴 AstNode

GetName() 공개 메소드

Returns the function name as a string
public GetName ( ) : string
리턴 string

GetParams() 공개 메소드

Returns the function parameter list
public GetParams ( ) : IList
리턴 IList

GetResumptionPoints() 공개 메소드

public GetResumptionPoints ( ) : IList
리턴 IList

GetRp() 공개 메소드

Returns right paren position, -1 if missing
public GetRp ( ) : int
리턴 int

IsExpressionClosure() 공개 메소드

Returns whether this is a 1.8 function closure
public IsExpressionClosure ( ) : bool
리턴 bool

IsGenerator() 공개 메소드

public IsGenerator ( ) : bool
리턴 bool

IsGetter() 공개 메소드

public IsGetter ( ) : bool
리턴 bool

IsGetterOrSetter() 공개 메소드

public IsGetterOrSetter ( ) : bool
리턴 bool

IsParam() 공개 메소드

Returns true if the specified AstNode node is a parameter of this Function node. This provides a way during AST traversal to disambiguate the function name node from the parameter nodes.
public IsParam ( AstNode node ) : bool
node AstNode
리턴 bool

IsSetter() 공개 메소드

public IsSetter ( ) : bool
리턴 bool

RequiresActivation() 공개 메소드

Return true if this function requires an Ecma-262 Activation object.
Return true if this function requires an Ecma-262 Activation object. The Activation object is implemented by Rhino.NativeCall , and is fairly expensive to create, so when possible, the interpreter attempts to use a plain call frame instead.
public RequiresActivation ( ) : bool
리턴 bool

SetBody() 공개 메소드

Sets function body, and sets its parent to this node.
Sets function body, and sets its parent to this node. Also sets the encoded source bounds based on the body bounds. Assumes the function node absolute position has already been set, and the body node's absolute position and length are set.

/// if body is /// null ///
public SetBody ( AstNode body ) : void
body AstNode /// function body. Its parent is set to this node, and its /// position is updated to be relative to this node. ///
리턴 void

SetFunctionIsGetter() 공개 메소드

public SetFunctionIsGetter ( ) : void
리턴 void

SetFunctionIsSetter() 공개 메소드

public SetFunctionIsSetter ( ) : void
리턴 void

SetFunctionName() 공개 메소드

Sets function name, and sets its parent to this node.
Sets function name, and sets its parent to this node.
public SetFunctionName ( Name name ) : void
name Name /// function name, /// null /// for anonymous functions ///
리턴 void

SetFunctionType() 공개 메소드

public SetFunctionType ( int type ) : void
type int
리턴 void

SetIsExpressionClosure() 공개 메소드

Sets whether this is a 1.8 function closure
public SetIsExpressionClosure ( bool isExpressionClosure ) : void
isExpressionClosure bool
리턴 void

SetIsGenerator() 공개 메소드

public SetIsGenerator ( ) : void
리턴 void

SetLp() 공개 메소드

Sets left paren position
public SetLp ( int lp ) : void
lp int
리턴 void

SetMemberExprNode() 공개 메소드

Rhino supports a nonstandard Ecma extension that allows you to say, for instance, function a.b.c(arg1, arg) {...}, and it will be rewritten at codegen time to: a.b.c = function(arg1, arg2) {...} If we detect an expression other than a simple Name in the position where a function name was expected, we record that expression here.
Rhino supports a nonstandard Ecma extension that allows you to say, for instance, function a.b.c(arg1, arg) {...}, and it will be rewritten at codegen time to: a.b.c = function(arg1, arg2) {...} If we detect an expression other than a simple Name in the position where a function name was expected, we record that expression here.

This extension is only available by setting the CompilerEnv option "isAllowMemberExprAsFunctionName" in the Parser.

public SetMemberExprNode ( AstNode node ) : void
node AstNode
리턴 void

SetParams() 공개 메소드

Sets the function parameter list, and sets the parent for each element of the list.
Sets the function parameter list, and sets the parent for each element of the list.
public SetParams ( IList @params ) : void
@params IList
리턴 void

SetParens() 공개 메소드

Sets both paren positions
public SetParens ( int lp, int rp ) : void
lp int
rp int
리턴 void

SetRequiresActivation() 공개 메소드

public SetRequiresActivation ( ) : void
리턴 void

SetRp() 공개 메소드

Sets right paren position
public SetRp ( int rp ) : void
rp int
리턴 void

ToSource() 공개 메소드

public ToSource ( int depth ) : string
depth int
리턴 string

Visit() 공개 메소드

Visits this node, the function name node if supplied, the parameters, and the body.
Visits this node, the function name node if supplied, the parameters, and the body. If there is a member-expr node, it is visited last.
public Visit ( NodeVisitor v ) : void
v NodeVisitor
리턴 void