C# Class Rhino.IRFactory

This class rewrites the parse tree into an IR suitable for codegen.
This class rewrites the parse tree into an IR suitable for codegen.
Inheritance: Parser
Show file Open project: hazzik/Rhino.Net Class Usage Examples

Public Methods

Method Description
IRFactory ( ) : System
IRFactory ( CompilerEnvirons env ) : System
IRFactory ( CompilerEnvirons env, ErrorReporter errorReporter ) : System
Transform ( AstNode node ) : Node
TransformTree ( AstRoot root ) : ScriptNode

Transforms the tree into a lower-level IR suitable for codegen.

Transforms the tree into a lower-level IR suitable for codegen. Optionally generates the encoded source.

Private Methods

Method Description
AddSwitchCase ( Node switchBlock, Node caseExpression, Node statements ) : void

If caseExpression argument is null it indicates a default label.

If caseExpression argument is null it indicates a default label.

ArrayCompTransformHelper ( ArrayComprehension node, string arrayName ) : Node
CloseSwitch ( Node switchBlock ) : void
CreateAssignment ( int assignType, Node left, Node right ) : Node
CreateBinary ( int nodeType, Node left, Node right ) : Node
CreateCallOrNew ( int nodeType, Node child ) : Node
CreateCatch ( string varName, Node catchCond, Node stmts, int lineno ) : Node

Catch clause of try/catch/finally

CreateCondExpr ( Node cond, Node ifTrue, Node ifFalse ) : Node
CreateElementGet ( Node target, string @namespace, Node elem, int memberTypeFlags ) : Node
CreateExprStatementNoReturn ( Node expr, int lineno ) : Node
CreateFor ( Scope loop, Node init, Node test, Node incr, Node body ) : Node
CreateForIn ( int declType, Node loop, Node lhs, Node obj, Node body, bool isForEach ) : Node

Generate IR for a for..in loop.

Generate IR for a for..in loop.

CreateIf ( Node cond, Node ifTrue, Node ifFalse, int lineno ) : Node
CreateIncDec ( int nodeType, bool post, Node child ) : Node
CreateLoop ( Jump loop, int loopType, Node body, Node cond, Node init, Node incr ) : Node
CreateLoopNode ( Node loopLabel, int lineno ) : Scope

Create loop node.

Create loop node. The code generator will later call createWhile|createDoWhile|createFor|createForIn to finish loop generation.

CreateMemberRefGet ( Node target, string @namespace, Node elem, int memberTypeFlags ) : Node
CreatePropertyGet ( Node target, string @namespace, string name, int memberTypeFlags ) : Node
CreateString ( string @string ) : Node
CreateTryCatchFinally ( Node tryBlock, Node catchBlocks, Node finallyBlock, int lineno ) : Node

Try/Catch/Finally The IRFactory tries to express as much as possible in the tree; the responsibilities remaining for Codegen are to add the Java handlers: (Either (but not both) of TARGET and FINALLY might not be defined) - a catch handler for javascript exceptions that unwraps the exception onto the stack and GOTOes to the catch target - a finally handler ...

Try/Catch/Finally The IRFactory tries to express as much as possible in the tree; the responsibilities remaining for Codegen are to add the Java handlers: (Either (but not both) of TARGET and FINALLY might not be defined) - a catch handler for javascript exceptions that unwraps the exception onto the stack and GOTOes to the catch target - a finally handler ... and a goto to GOTO around these handlers.

CreateUnary ( int nodeType, Node child ) : Node
CreateUseLocal ( Node localBlock ) : Node
CreateWith ( Node obj, Node body, int lineno ) : Node
Decompile ( AstNode node ) : void
DecompileArrayLiteral ( ArrayLiteral node ) : void
DecompileElementGet ( ElementGet node ) : void
DecompileFunctionHeader ( FunctionNode fn ) : Node
DecompileObjectLiteral ( ObjectLiteral node ) : void
DecompilePropertyGet ( PropertyGet node ) : void
GenExprTransformHelper ( GeneratorExpression node ) : Node
GetPropKey ( Node id ) : object
InitFunction ( FunctionNode fnNode, int functionIndex, Node statements, int functionType ) : Node
IsAlwaysDefinedBoolean ( Node node ) : int
IsDestructuring ( Node n ) : bool
MakeJump ( int type, Node target ) : Jump
MakeReference ( Node node ) : Node
TransformArrayComp ( ArrayComprehension node ) : Node
TransformArrayLiteral ( ArrayLiteral node ) : Node
TransformAssignment ( Assignment node ) : Node
TransformBlock ( AstNode node ) : Node
TransformBreak ( BreakStatement node ) : Node
TransformCondExpr ( ConditionalExpression node ) : Node
TransformContinue ( ContinueStatement node ) : Node
TransformDefaultXmlNamepace ( UnaryExpression node ) : Node
TransformDoLoop ( DoLoop loop ) : Node
TransformElementGet ( ElementGet node ) : Node
TransformExprStmt ( ExpressionStatement node ) : Node
TransformForInLoop ( ForInLoop loop ) : Node
TransformForLoop ( ForLoop loop ) : Node
TransformFunction ( FunctionNode fn ) : Node
TransformFunctionCall ( FunctionCall node ) : Node
TransformGenExpr ( GeneratorExpression node ) : Node
TransformIf ( IfStatement n ) : Node
TransformInfix ( InfixExpression node ) : Node
TransformLabeledStatement ( LabeledStatement ls ) : Node
TransformLetNode ( LetNode node ) : Node
TransformLiteral ( AstNode node ) : Node
TransformName ( Name node ) : Node
TransformNewExpr ( NewExpression node ) : Node
TransformNumber ( NumberLiteral node ) : Node
TransformObjectLiteral ( ObjectLiteral node ) : Node
TransformParenExpr ( ParenthesizedExpression node ) : Node
TransformPropertyGet ( PropertyGet node ) : Node
TransformRegExp ( RegExpLiteral node ) : Node
TransformReturn ( ReturnStatement node ) : Node
TransformScript ( ScriptNode node ) : Node
TransformString ( StringLiteral node ) : Node
TransformSwitch ( SwitchStatement node ) : Node
TransformThrow ( ThrowStatement node ) : Node
TransformTry ( TryStatement node ) : Node
TransformUnary ( UnaryExpression node ) : Node
TransformVariableInitializers ( VariableDeclaration node ) : Node
TransformVariables ( VariableDeclaration node ) : Node
TransformWhileLoop ( WhileLoop loop ) : Node
TransformWith ( WithStatement node ) : Node
TransformXmlLiteral ( XmlLiteral node ) : Node
TransformXmlMemberGet ( XmlMemberGet node ) : Node
TransformXmlRef ( Node pn, XmlRef node, int memberTypeFlags ) : Node
TransformXmlRef ( XmlRef node ) : Node
TransformYield ( Yield node ) : Node

Method Details

IRFactory() public method

public IRFactory ( ) : System
return System

IRFactory() public method

public IRFactory ( CompilerEnvirons env ) : System
env CompilerEnvirons
return System

IRFactory() public method

public IRFactory ( CompilerEnvirons env, ErrorReporter errorReporter ) : System
env CompilerEnvirons
errorReporter ErrorReporter
return System

Transform() public method

public Transform ( AstNode node ) : Node
node AstNode
return Node

TransformTree() public method

Transforms the tree into a lower-level IR suitable for codegen.
Transforms the tree into a lower-level IR suitable for codegen. Optionally generates the encoded source.
public TransformTree ( AstRoot root ) : ScriptNode
root Rhino.Ast.AstRoot
return Rhino.Ast.ScriptNode