C# Class Rhino.Ast.SwitchCase

Switch-case AST node type.
Switch-case AST node type. The switch case is always part of a switch statement. Node type is Rhino.Token.CASE .

CaseBlock : { [CaseClauses] } { [CaseClauses] DefaultClause [CaseClauses] } CaseClauses : CaseClause CaseClauses CaseClause CaseClause : case Expression : [StatementList] DefaultClause : default : [StatementList]
Inheritance: AstNode
Show file Open project: hazzik/Rhino.Net Class Usage Examples

Public Methods

Method Description
AddStatement ( AstNode statement ) : void

Adds a statement to the end of the statement list.

Adds a statement to the end of the statement list. Sets the parent of the new statement to this node, updates its start offset to be relative to this node, and sets the length of this node to include the new child.

GetExpression ( ) : AstNode

Returns the case expression, null for default case

GetStatements ( ) : IList

Returns statement list, which may be null .

IsDefault ( ) : bool

Return true if this is a default case.

Return true if this is a default case.

SetExpression ( AstNode expression ) : void

Sets the case expression, null for default case. Note that for empty fall-through cases, they still have a case expression. In case 0: case 1: break; the first case has an expression that is a NumberLiteral with value 0 .

SetStatements ( IList statements ) : void

Sets statement list.

Sets statement list. May be null . Replaces any existing statements. Each element in the list has its parent set to this node.

SwitchCase ( ) : System.Collections.Generic
SwitchCase ( int pos ) : System.Collections.Generic
SwitchCase ( int pos, int len ) : System.Collections.Generic
ToSource ( int depth ) : string
Visit ( NodeVisitor v ) : void

Visits this node, then the case expression if present, then each statement (if any are specified).

Visits this node, then the case expression if present, then each statement (if any are specified).

Method Details

AddStatement() public method

Adds a statement to the end of the statement list.
Adds a statement to the end of the statement list. Sets the parent of the new statement to this node, updates its start offset to be relative to this node, and sets the length of this node to include the new child.
/// } if statement is /// null ///
public AddStatement ( AstNode statement ) : void
statement AstNode a child statement
return void

GetExpression() public method

Returns the case expression, null for default case
public GetExpression ( ) : AstNode
return AstNode

GetStatements() public method

Returns statement list, which may be null .
public GetStatements ( ) : IList
return IList

IsDefault() public method

Return true if this is a default case.
Return true if this is a default case.
public IsDefault ( ) : bool
return bool

SetExpression() public method

Sets the case expression, null for default case. Note that for empty fall-through cases, they still have a case expression. In case 0: case 1: break; the first case has an expression that is a NumberLiteral with value 0 .
public SetExpression ( AstNode expression ) : void
expression AstNode
return void

SetStatements() public method

Sets statement list.
Sets statement list. May be null . Replaces any existing statements. Each element in the list has its parent set to this node.
public SetStatements ( IList statements ) : void
statements IList
return void

SwitchCase() public method

public SwitchCase ( ) : System.Collections.Generic
return System.Collections.Generic

SwitchCase() public method

public SwitchCase ( int pos ) : System.Collections.Generic
pos int
return System.Collections.Generic

SwitchCase() public method

public SwitchCase ( int pos, int len ) : System.Collections.Generic
pos int
len int
return System.Collections.Generic

ToSource() public method

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

Visit() public method

Visits this node, then the case expression if present, then each statement (if any are specified).
Visits this node, then the case expression if present, then each statement (if any are specified).
public Visit ( NodeVisitor v ) : void
v NodeVisitor
return void