C# Class Rhino.Ast.ArrayLiteral

AST node for an Array literal.
AST node for an Array literal. The elements list will always be non- null , although the list will have no elements if the Array literal is empty.

Node type is Rhino.Token.ARRAYLIT .

ArrayLiteral : [ Elisionopt ] [ ElementList ] [ ElementList , Elisionopt ] ElementList : Elisionopt AssignmentExpression ElementList , Elisionopt AssignmentExpression Elision : , Elision ,
Inheritance: AstNode, DestructuringForm
Exibir arquivo Open project: hazzik/Rhino.Net Class Usage Examples

Public Methods

Method Description
AddElement ( AstNode element ) : void

Adds an element to the list, and sets its parent to this node.

Adds an element to the list, and sets its parent to this node.

ArrayLiteral ( ) : System
ArrayLiteral ( int pos ) : System
ArrayLiteral ( int pos, int len ) : System
GetDestructuringLength ( ) : int

Returns destructuring length

GetElement ( int index ) : AstNode

Returns element at specified index.

Returns element at specified index.

GetElements ( ) : IList

Returns the element list

GetSize ( ) : int

Returns the number of elements in this Array literal, including empty elements.

GetSkipCount ( ) : int

Used by code generator.

Used by code generator.

IsDestructuring ( ) : bool

Returns true if this node is in a destructuring position: a function parameter, the target of a variable initializer, the iterator of a for..in loop, etc.

Returns true if this node is in a destructuring position: a function parameter, the target of a variable initializer, the iterator of a for..in loop, etc.

SetDestructuringLength ( int destructuringLength ) : void

Sets destructuring length.

Sets destructuring length. This is set by the parser and used by the code generator. for ([a,] in obj) is legal, but for ([a] in obj) is not since we have both key and value supplied. The difference is only meaningful in array literals used in destructuring-assignment contexts.

SetElements ( IList elements ) : void

Sets the element list, and sets each element's parent to this node.

Sets the element list, and sets each element's parent to this node.

SetIsDestructuring ( bool destructuring ) : void

Marks this node as being a destructuring form - that is, appearing in a context such as for ([a, b] in ...) where it's the target of a destructuring assignment.

SetSkipCount ( int count ) : void

Used by code generator.

Used by code generator.

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

Visits this node, then visits its element expressions in order.

Visits this node, then visits its element expressions in order. Any empty elements are represented by EmptyExpression objects, so the callback will never be passed null .

Method Details

AddElement() public method

Adds an element to the list, and sets its parent to this node.
Adds an element to the list, and sets its parent to this node.
/// if element is /// null /// . To indicate /// an empty element, use an /// EmptyExpression /// node. ///
public AddElement ( AstNode element ) : void
element AstNode the element to add
return void

ArrayLiteral() public method

public ArrayLiteral ( ) : System
return System

ArrayLiteral() public method

public ArrayLiteral ( int pos ) : System
pos int
return System

ArrayLiteral() public method

public ArrayLiteral ( int pos, int len ) : System
pos int
len int
return System

GetDestructuringLength() public method

Returns destructuring length
public GetDestructuringLength ( ) : int
return int

GetElement() public method

Returns element at specified index.
Returns element at specified index.
if the index is invalid
public GetElement ( int index ) : AstNode
index int the index of the element to retrieve
return AstNode

GetElements() public method

Returns the element list
public GetElements ( ) : IList
return IList

GetSize() public method

Returns the number of elements in this Array literal, including empty elements.
public GetSize ( ) : int
return int

GetSkipCount() public method

Used by code generator.
Used by code generator.
public GetSkipCount ( ) : int
return int

IsDestructuring() public method

Returns true if this node is in a destructuring position: a function parameter, the target of a variable initializer, the iterator of a for..in loop, etc.
Returns true if this node is in a destructuring position: a function parameter, the target of a variable initializer, the iterator of a for..in loop, etc.
public IsDestructuring ( ) : bool
return bool

SetDestructuringLength() public method

Sets destructuring length.
Sets destructuring length. This is set by the parser and used by the code generator. for ([a,] in obj) is legal, but for ([a] in obj) is not since we have both key and value supplied. The difference is only meaningful in array literals used in destructuring-assignment contexts.
public SetDestructuringLength ( int destructuringLength ) : void
destructuringLength int
return void

SetElements() public method

Sets the element list, and sets each element's parent to this node.
Sets the element list, and sets each element's parent to this node.
public SetElements ( IList elements ) : void
elements IList /// the element list. Can be /// null /// . ///
return void

SetIsDestructuring() public method

Marks this node as being a destructuring form - that is, appearing in a context such as for ([a, b] in ...) where it's the target of a destructuring assignment.
public SetIsDestructuring ( bool destructuring ) : void
destructuring bool
return void

SetSkipCount() public method

Used by code generator.
Used by code generator.
public SetSkipCount ( int count ) : void
count int the count of empty elements
return void

ToSource() public method

public ToSource ( int depth ) : string
depth int
return string

Visit() public method

Visits this node, then visits its element expressions in order.
Visits this node, then visits its element expressions in order. Any empty elements are represented by EmptyExpression objects, so the callback will never be passed null .
public Visit ( NodeVisitor v ) : void
v NodeVisitor
return void