C# Class Jurassic.Compiler.DeclarativeScope

Represents a scope where the variables are statically known.
Inheritance: Scope
Show file Open project: paulbartrum/jurassic Class Usage Examples

Public Methods

Method Description
CreateRuntimeScope ( Scope parentScope, string declaredVariableNames ) : DeclarativeScope

Creates a new declarative scope for use at runtime.

Delete ( string variableName ) : bool

Deletes the variable from the scope.

GetValue ( string variableName ) : object

Returns the value of the given variable.

HasValue ( string variableName ) : bool

Returns true if the given variable exists in this scope.

SetValue ( string variableName, object value ) : void

Sets the value of the given variable.

Private Methods

Method Description
CreateCatchScope ( Scope parentScope, string catchVariableName ) : DeclarativeScope

Creates a new declarative scope for use inside a catch statement.

CreateEvalScope ( Scope parentScope ) : DeclarativeScope

Creates a new declarative scope for use inside a strict mode eval statement.

CreateFunctionScope ( Scope parentScope, string functionName, IEnumerable argumentNames ) : DeclarativeScope

Creates a new declarative scope for use inside a function body (and within function argument default values).

DeclarativeScope ( Scope parentScope, int declaredVariableCount ) : System

Creates a new DeclarativeScope instance.

DeclareVariable ( string name, Jurassic.Compiler.Expression valueAtTopOfScope = null, bool writable = true, bool deletable = false ) : DeclaredVariable

Declares a variable or function in this scope. This will be initialized with the value of the given expression.

GenerateScopeCreation ( ILGenerator generator, OptimizationInfo optimizationInfo ) : void

Generates code that creates a new scope.

Method Details

CreateRuntimeScope() public static method

Creates a new declarative scope for use at runtime.
public static CreateRuntimeScope ( Scope parentScope, string declaredVariableNames ) : DeclarativeScope
parentScope Scope A reference to the parent scope. Can not be null.
declaredVariableNames string The names of variables that were declared in this scope.
return DeclarativeScope

Delete() public method

Deletes the variable from the scope.
public Delete ( string variableName ) : bool
variableName string The name of the variable.
return bool

GetValue() public method

Returns the value of the given variable.
The scope was not created using /// CreateRuntimeScope().
public GetValue ( string variableName ) : object
variableName string The name of the variable.
return object

HasValue() public method

Returns true if the given variable exists in this scope.
public HasValue ( string variableName ) : bool
variableName string The name of the variable to check.
return bool

SetValue() public method

Sets the value of the given variable.
The scope was not created using /// CreateRuntimeScope().
public SetValue ( string variableName, object value ) : void
variableName string The name of the variable.
value object The new value of the variable.
return void