C# Class Rhino.Ast.ScriptNode

Base type for AstRoot and FunctionNode nodes, which need to collect much of the same information.
Inheritance: Scope
Show file Open project: hazzik/Rhino.Net Class Usage Examples

Public Methods

Method Description
AddFunction ( FunctionNode fnNode ) : int

Adds a FunctionNode to the functions table for codegen. Does not set the parent of the node.

AddRegExp ( RegExpLiteral re ) : void

Called by IRFactory to add a RegExp to the regexp table.

Called by IRFactory to add a RegExp to the regexp table.

FlattenSymbolTable ( bool flattenAllTables ) : void

Assign every symbol a unique integer index.

Assign every symbol a unique integer index. Generate arrays of variable names and constness that can be indexed by those indices.

GetBaseLineno ( ) : int
GetCompilerData ( ) : object
GetEncodedSource ( ) : string

Returns a canonical version of the source for this script or function, for use in implementing the Object.toSource method of JavaScript objects. This source encoding is only recorded during code generation. It must be passed back to Rhino.Decompiler.Decompile(string, int, Rhino.UintMap) to construct the human-readable source string.

Given a parsed AST, you can always convert it to source code using the AstNode.ToSource() method, although it's not guaranteed to produce exactly the same results as Object.toSource with respect to formatting, parenthesization and other details.

GetEncodedSourceEnd ( ) : int

Returns the end offset of the encoded source.

Returns the end offset of the encoded source. Only valid if GetEncodedSource() returns non- null .

GetEncodedSourceStart ( ) : int

Returns the start offset of the encoded source.

Returns the start offset of the encoded source. Only valid if GetEncodedSource() returns non- null .

GetEndLineno ( ) : int
GetFunctionCount ( ) : int
GetFunctionNode ( int i ) : FunctionNode
GetFunctions ( ) : IList
GetIndexForNameNode ( Node nameNode ) : int
GetNextTempName ( ) : string
GetParamAndVarConst ( ) : bool[]
GetParamAndVarCount ( ) : int
GetParamAndVarNames ( ) : string[]
GetParamCount ( ) : int
GetParamOrVarName ( int index ) : string
GetRegexpCount ( ) : int
GetRegexpFlags ( int index ) : string
GetRegexpString ( int index ) : string
GetSourceName ( ) : string

Returns the URI, path or descriptive text indicating the origin of this script's source code.

Returns the URI, path or descriptive text indicating the origin of this script's source code.

GetSymbols ( ) : IList
ScriptNode ( ) : System
ScriptNode ( int pos ) : System
SetBaseLineno ( int lineno ) : void

Sets base (starting) line number for this script or function.

Sets base (starting) line number for this script or function. This is a one-time operation, and throws an exception if the line number has already been set.

SetCompilerData ( object data ) : void
SetEncodedSource ( string encodedSource ) : void

Used by the code generator.

Used by the code generator.

SetEncodedSourceBounds ( int start, int end ) : void

Used by code generator.

Used by code generator.

SetEncodedSourceEnd ( int end ) : void

Used by code generator.

Used by code generator.

SetEncodedSourceStart ( int start ) : void

Used by code generator.

Used by code generator.

SetEndLineno ( int lineno ) : void
SetSourceName ( string sourceName ) : void

Sets the URI, path or descriptive text indicating the origin of this script's source code.

Sets the URI, path or descriptive text indicating the origin of this script's source code.

SetSymbols ( IList symbols ) : void
Visit ( NodeVisitor v ) : void

Private Methods

Method Description
AddSymbol ( Symbol symbol ) : void

Method Details

AddFunction() public method

Adds a FunctionNode to the functions table for codegen. Does not set the parent of the node.
public AddFunction ( FunctionNode fnNode ) : int
fnNode FunctionNode
return int

AddRegExp() public method

Called by IRFactory to add a RegExp to the regexp table.
Called by IRFactory to add a RegExp to the regexp table.
public AddRegExp ( RegExpLiteral re ) : void
re RegExpLiteral
return void

FlattenSymbolTable() public method

Assign every symbol a unique integer index.
Assign every symbol a unique integer index. Generate arrays of variable names and constness that can be indexed by those indices.
public FlattenSymbolTable ( bool flattenAllTables ) : void
flattenAllTables bool /// if true, flatten all symbol tables, /// included nested block scope symbol tables. If false, just flatten the /// script's or function's symbol table. ///
return void

GetBaseLineno() public method

public GetBaseLineno ( ) : int
return int

GetCompilerData() public method

public GetCompilerData ( ) : object
return object

GetEncodedSource() public method

Returns a canonical version of the source for this script or function, for use in implementing the Object.toSource method of JavaScript objects. This source encoding is only recorded during code generation. It must be passed back to Rhino.Decompiler.Decompile(string, int, Rhino.UintMap) to construct the human-readable source string.

Given a parsed AST, you can always convert it to source code using the AstNode.ToSource() method, although it's not guaranteed to produce exactly the same results as Object.toSource with respect to formatting, parenthesization and other details.

public GetEncodedSource ( ) : string
return string

GetEncodedSourceEnd() public method

Returns the end offset of the encoded source.
Returns the end offset of the encoded source. Only valid if GetEncodedSource() returns non- null .
public GetEncodedSourceEnd ( ) : int
return int

GetEncodedSourceStart() public method

Returns the start offset of the encoded source.
Returns the start offset of the encoded source. Only valid if GetEncodedSource() returns non- null .
public GetEncodedSourceStart ( ) : int
return int

GetEndLineno() public method

public GetEndLineno ( ) : int
return int

GetFunctionCount() public method

public GetFunctionCount ( ) : int
return int

GetFunctionNode() public method

public GetFunctionNode ( int i ) : FunctionNode
i int
return FunctionNode

GetFunctions() public method

public GetFunctions ( ) : IList
return IList

GetIndexForNameNode() public method

public GetIndexForNameNode ( Node nameNode ) : int
nameNode Node
return int

GetNextTempName() public method

public GetNextTempName ( ) : string
return string

GetParamAndVarConst() public method

public GetParamAndVarConst ( ) : bool[]
return bool[]

GetParamAndVarCount() public method

public GetParamAndVarCount ( ) : int
return int

GetParamAndVarNames() public method

public GetParamAndVarNames ( ) : string[]
return string[]

GetParamCount() public method

public GetParamCount ( ) : int
return int

GetParamOrVarName() public method

public GetParamOrVarName ( int index ) : string
index int
return string

GetRegexpCount() public method

public GetRegexpCount ( ) : int
return int

GetRegexpFlags() public method

public GetRegexpFlags ( int index ) : string
index int
return string

GetRegexpString() public method

public GetRegexpString ( int index ) : string
index int
return string

GetSourceName() public method

Returns the URI, path or descriptive text indicating the origin of this script's source code.
Returns the URI, path or descriptive text indicating the origin of this script's source code.
public GetSourceName ( ) : string
return string

GetSymbols() public method

public GetSymbols ( ) : IList
return IList

ScriptNode() public method

public ScriptNode ( ) : System
return System

ScriptNode() public method

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

SetBaseLineno() public method

Sets base (starting) line number for this script or function.
Sets base (starting) line number for this script or function. This is a one-time operation, and throws an exception if the line number has already been set.
public SetBaseLineno ( int lineno ) : void
lineno int
return void

SetCompilerData() public method

public SetCompilerData ( object data ) : void
data object
return void

SetEncodedSource() public method

Used by the code generator.
Used by the code generator.
public SetEncodedSource ( string encodedSource ) : void
encodedSource string
return void

SetEncodedSourceBounds() public method

Used by code generator.
Used by code generator.
public SetEncodedSourceBounds ( int start, int end ) : void
start int
end int
return void

SetEncodedSourceEnd() public method

Used by code generator.
Used by code generator.
public SetEncodedSourceEnd ( int end ) : void
end int
return void

SetEncodedSourceStart() public method

Used by code generator.
Used by code generator.
public SetEncodedSourceStart ( int start ) : void
start int
return void

SetEndLineno() public method

public SetEndLineno ( int lineno ) : void
lineno int
return void

SetSourceName() public method

Sets the URI, path or descriptive text indicating the origin of this script's source code.
Sets the URI, path or descriptive text indicating the origin of this script's source code.
public SetSourceName ( string sourceName ) : void
sourceName string
return void

SetSymbols() public method

public SetSymbols ( IList symbols ) : void
symbols IList
return void

Visit() public method

public Visit ( NodeVisitor v ) : void
v NodeVisitor
return void