C# Class Rhino.Ast.Scope

Represents a scope in the lexical scope chain.
Represents a scope in the lexical scope chain. Base type for all AstNode implementations that can introduce a new scope.
Inheritance: Jump
显示文件 Open project: hazzik/Rhino.Net Class Usage Examples

Protected Properties

Property Type Description
parentScope Scope
symbolTable Symbol>.IDictionary
top ScriptNode

Public Methods

Method Description
AddChildScope ( Rhino child ) : void

Add a scope to our list of child scopes.

Add a scope to our list of child scopes. Sets the child's parent scope to this scope.

ClearParentScope ( ) : void

Used only for code generation.

Used only for code generation.

GetChildScopes ( ) : IList

Return a list of the scopes whose parent is this scope.

Return a list of the scopes whose parent is this scope.

GetDefiningScope ( string name ) : Scope

Returns the scope in which this name is defined

GetParentScope ( ) : Scope
GetStatements ( ) : IList

Returns a copy of the child list, with each child cast to an AstNode .

GetSymbol ( string name ) : Symbol

Looks up a symbol in this scope.

Looks up a symbol in this scope.

GetSymbolTable ( ) : Symbol>.IDictionary

Returns the symbol table for this scope.

Returns the symbol table for this scope.

GetTop ( ) : ScriptNode

Returns current script or function scope

JoinScopes ( Rhino source, Rhino dest ) : void

Copies all symbols from source scope to dest scope.

Copies all symbols from source scope to dest scope.

PutSymbol ( Symbol symbol ) : void

Enters a symbol into this scope.

Enters a symbol into this scope.

ReplaceWith ( Rhino newScope ) : void

Used by the parser; not intended for typical use.

Used by the parser; not intended for typical use. Changes the parent-scope links for this scope's child scopes to the specified new scope. Copies symbols from this scope into new scope.

Scope ( ) : System
Scope ( int pos ) : System
Scope ( int pos, int len ) : System
SetParentScope ( Rhino parentScope ) : void

Sets parent scope

SetSymbolTable ( Symbol>.IDictionary table ) : void

Sets the symbol table for this scope.

Sets the symbol table for this scope. May be null .

SetTop ( ScriptNode top ) : void

Sets top current script or function scope

SplitScope ( Rhino scope ) : Scope

Creates a new scope node, moving symbol table information from "scope" to the new node, and making "scope" a nested scope contained by the new node.

Creates a new scope node, moving symbol table information from "scope" to the new node, and making "scope" a nested scope contained by the new node. Useful for injecting a new scope in a scope chain.

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

Private Methods

Method Description
EnsureSymbolTable ( ) : Symbol>.IDictionary

Method Details

AddChildScope() public method

Add a scope to our list of child scopes.
Add a scope to our list of child scopes. Sets the child's parent scope to this scope.
/// if the child's parent scope is /// non- /// null ///
public AddChildScope ( Rhino child ) : void
child Rhino
return void

ClearParentScope() public method

Used only for code generation.
Used only for code generation.
public ClearParentScope ( ) : void
return void

GetChildScopes() public method

Return a list of the scopes whose parent is this scope.
Return a list of the scopes whose parent is this scope.
public GetChildScopes ( ) : IList
return IList

GetDefiningScope() public method

Returns the scope in which this name is defined
public GetDefiningScope ( string name ) : Scope
name string the symbol to look up
return Scope

GetParentScope() public method

public GetParentScope ( ) : Scope
return Scope

GetStatements() public method

Returns a copy of the child list, with each child cast to an AstNode .
/// if any non- /// AstNode /// objects are /// in the child list, e.g. if this method is called after the code /// generator begins the tree transformation. ///
public GetStatements ( ) : IList
return IList

GetSymbol() public method

Looks up a symbol in this scope.
Looks up a symbol in this scope.
public GetSymbol ( string name ) : Symbol
name string the symbol name
return Symbol

GetSymbolTable() public method

Returns the symbol table for this scope.
Returns the symbol table for this scope.
public GetSymbolTable ( ) : Symbol>.IDictionary
return Symbol>.IDictionary

GetTop() public method

Returns current script or function scope
public GetTop ( ) : ScriptNode
return ScriptNode

JoinScopes() public static method

Copies all symbols from source scope to dest scope.
Copies all symbols from source scope to dest scope.
public static JoinScopes ( Rhino source, Rhino dest ) : void
source Rhino
dest Rhino
return void

PutSymbol() public method

Enters a symbol into this scope.
Enters a symbol into this scope.
public PutSymbol ( Symbol symbol ) : void
symbol Symbol
return void

ReplaceWith() public method

Used by the parser; not intended for typical use.
Used by the parser; not intended for typical use. Changes the parent-scope links for this scope's child scopes to the specified new scope. Copies symbols from this scope into new scope.
public ReplaceWith ( Rhino newScope ) : void
newScope Rhino /// the scope that will replace this one on the /// scope stack. ///
return void

Scope() public method

public Scope ( ) : System
return System

Scope() public method

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

Scope() public method

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

SetParentScope() public method

Sets parent scope
public SetParentScope ( Rhino parentScope ) : void
parentScope Rhino
return void

SetSymbolTable() public method

Sets the symbol table for this scope.
Sets the symbol table for this scope. May be null .
public SetSymbolTable ( Symbol>.IDictionary table ) : void
table Symbol>.IDictionary
return void

SetTop() public method

Sets top current script or function scope
public SetTop ( ScriptNode top ) : void
top ScriptNode
return void

SplitScope() public static method

Creates a new scope node, moving symbol table information from "scope" to the new node, and making "scope" a nested scope contained by the new node.
Creates a new scope node, moving symbol table information from "scope" to the new node, and making "scope" a nested scope contained by the new node. Useful for injecting a new scope in a scope chain.
public static SplitScope ( Rhino scope ) : Scope
scope Rhino
return Scope

ToSource() public method

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

Visit() public method

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

Property Details

parentScope protected_oe property

protected Scope,Rhino.Ast parentScope
return Scope

symbolTable protected_oe property

protected IDictionary symbolTable
return Symbol>.IDictionary

top protected_oe property

protected ScriptNode,Rhino.Ast top
return ScriptNode