C# Class Pchp.CodeAnalysis.FlowAnalysis.AnalysisVisitor

Inheritance: Pchp.CodeAnalysis.Semantics.Graph.GraphVisitor
Datei anzeigen Open project: iolevel/peachpie

Private Properties

Property Type Description
AnalysisVisitor Pchp.CodeAnalysis.Semantics.Graph
AssertState void
TraverseToBlock void
VisitCondition void

Public Methods

Method Description
VisitBinaryExpression ( BoundBinaryEx x ) : void
VisitCFG ( ControlFlowGraph x ) : void
VisitCFGBlock ( BoundBlock x ) : void
VisitCFGCaseBlock ( CaseBlock x ) : void
VisitCFGCatchBlock ( CatchBlock x ) : void
VisitCFGConditionalEdge ( ConditionalEdge x ) : void
VisitCFGExitBlock ( ExitBlock x ) : void
VisitCFGForeachEnumereeEdge ( ForeachEnumereeEdge x ) : void
VisitCFGForeachMoveNextEdge ( ForeachMoveNextEdge x ) : void
VisitCFGSimpleEdge ( SimpleEdge x ) : void
VisitCFGSwitchEdge ( SwitchEdge x ) : void
VisitCFGTryCatchEdge ( TryCatchEdge x ) : void
VisitInstanceOf ( BoundInstanceOfEx x ) : void
VisitUnaryExpression ( BoundUnaryEx x ) : void

Protected Methods

Method Description
HandleTraversableUse ( BoundExpression varuse ) : TypeRefMask

Handles use of variable as foreach iterator value.

SetVar ( string name, TypeRefMask typemask ) : TypeRefMask

Sets type of local variable in current state.

Visit ( BoundBinaryEx x, ConditionBranch branch ) : void
Visit ( BoundInstanceOfEx x, ConditionBranch branch ) : void
Visit ( BoundUnaryEx x, ConditionBranch branch ) : void
VisitCFGBlockInit ( BoundBlock x ) : void

Called to initialize VisitCFGBlock call. Sets _state to known initial block state.

Private Methods

Method Description
AnalysisVisitor ( Worklist worklist ) : Pchp.CodeAnalysis.Semantics.Graph

Creates an instance of AnalysisVisitor that can analyse a block.

AssertState ( ) : void

Debug assert the state is initialized therefore we are in the middle on a block analysis.

TraverseToBlock ( FlowState state, BoundBlock target ) : void

Helper method that merges state with the target block and determines whether to continue by visiting the target block.

Only for traversing into blocks within the same routine (same type context).

VisitCondition ( BoundExpression condition, ConditionBranch branch ) : void

Visits condition used to branch execution to true or false branch.

Because of minimal evaluation there is different FlowState for true and false branches, AND and OR operators have to take this into account. Also some other constructs may have side-effect for known branch, eg. ($x instanceof X) implies ($x is X) in True branch.

Method Details

HandleTraversableUse() protected method

Handles use of variable as foreach iterator value.
protected HandleTraversableUse ( BoundExpression varuse ) : TypeRefMask
varuse Pchp.CodeAnalysis.Semantics.BoundExpression
return TypeRefMask

SetVar() protected method

Sets type of local variable in current state.
protected SetVar ( string name, TypeRefMask typemask ) : TypeRefMask
name string
typemask TypeRefMask
return TypeRefMask

Visit() protected method

protected Visit ( BoundBinaryEx x, ConditionBranch branch ) : void
x Pchp.CodeAnalysis.Semantics.BoundBinaryEx
branch ConditionBranch
return void

Visit() protected method

protected Visit ( BoundInstanceOfEx x, ConditionBranch branch ) : void
x Pchp.CodeAnalysis.Semantics.BoundInstanceOfEx
branch ConditionBranch
return void

Visit() protected method

protected Visit ( BoundUnaryEx x, ConditionBranch branch ) : void
x Pchp.CodeAnalysis.Semantics.BoundUnaryEx
branch ConditionBranch
return void

VisitBinaryExpression() public final method

public final VisitBinaryExpression ( BoundBinaryEx x ) : void
x Pchp.CodeAnalysis.Semantics.BoundBinaryEx
return void

VisitCFG() public method

public VisitCFG ( ControlFlowGraph x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.ControlFlowGraph
return void

VisitCFGBlock() public method

public VisitCFGBlock ( BoundBlock x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.BoundBlock
return void

VisitCFGBlockInit() protected method

Called to initialize VisitCFGBlock call. Sets _state to known initial block state.
protected VisitCFGBlockInit ( BoundBlock x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.BoundBlock
return void

VisitCFGCaseBlock() public method

public VisitCFGCaseBlock ( CaseBlock x ) : void
x CaseBlock
return void

VisitCFGCatchBlock() public method

public VisitCFGCatchBlock ( CatchBlock x ) : void
x CatchBlock
return void

VisitCFGConditionalEdge() public method

public VisitCFGConditionalEdge ( ConditionalEdge x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.ConditionalEdge
return void

VisitCFGExitBlock() public method

public VisitCFGExitBlock ( ExitBlock x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.ExitBlock
return void

VisitCFGForeachEnumereeEdge() public method

public VisitCFGForeachEnumereeEdge ( ForeachEnumereeEdge x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.ForeachEnumereeEdge
return void

VisitCFGForeachMoveNextEdge() public method

public VisitCFGForeachMoveNextEdge ( ForeachMoveNextEdge x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.ForeachMoveNextEdge
return void

VisitCFGSimpleEdge() public method

public VisitCFGSimpleEdge ( SimpleEdge x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.SimpleEdge
return void

VisitCFGSwitchEdge() public method

public VisitCFGSwitchEdge ( SwitchEdge x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.SwitchEdge
return void

VisitCFGTryCatchEdge() public method

public VisitCFGTryCatchEdge ( TryCatchEdge x ) : void
x Pchp.CodeAnalysis.Semantics.Graph.TryCatchEdge
return void

VisitInstanceOf() public final method

public final VisitInstanceOf ( BoundInstanceOfEx x ) : void
x Pchp.CodeAnalysis.Semantics.BoundInstanceOfEx
return void

VisitUnaryExpression() public final method

public final VisitUnaryExpression ( BoundUnaryEx x ) : void
x Pchp.CodeAnalysis.Semantics.BoundUnaryEx
return void