Class Throw
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.NaryStatement
-
- it.unive.lisa.program.cfg.statement.UnaryStatement
-
- it.unive.lisa.program.cfg.statement.Throw
-
- All Implemented Interfaces:
ProgramPoint
,CodeElement
,CodeNode<CFG,Statement,Edge>
,Node<CFG,Statement,Edge>
,java.lang.Comparable<Statement>
public class Throw extends UnaryStatement
A statement that raises an error, stopping the execution of the current CFG and propagating the error to among the call chain.
-
-
Constructor Summary
Constructors Constructor Description Throw(CFG cfg, CodeLocation location, Expression expression)
Builds the throw, raisingexpression
as error, happening at the given location in the program.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
compareSameClassAndParams(Statement o)
Auxiliary method forStatement.compareTo(Statement)
that can safely assume that the two statements happen at the sameCodeLocation
, are instances of the same class, and have the same parameters according to their implementation ofStatement.compareTo(Statement)
.<A extends AbstractState<A>>
AnalysisState<A>fwdUnarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression expr, StatementStore<A> expressions)
Computes the forward semantics of the statement, after the semantics of the sub-expression has been computed.boolean
stopsExecution()
Whether or not this statement stops the execution of the containing cfg, either by throwing an error or returning a value.boolean
throwsError()
Whether or not this statement throws an error, halting the normal execution of the containing cfg.-
Methods inherited from class it.unive.lisa.program.cfg.statement.UnaryStatement
backwardSemanticsAux, bwdUnarySemantics, forwardSemanticsAux, getSubExpression
-
Methods inherited from class it.unive.lisa.program.cfg.statement.NaryStatement
accept, backwardSemantics, compareSameClass, equals, forwardSemantics, getConstructName, getOrder, getStatementEvaluatedAfter, getStatementEvaluatedBefore, getSubExpressions, hashCode, toString
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Statement
compareTo, getCFG, getEvaluationPredecessor, getEvaluationSuccessor, getLocation
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.program.cfg.ProgramPoint
getProgram
-
-
-
-
Constructor Detail
-
Throw
public Throw(CFG cfg, CodeLocation location, Expression expression)
Builds the throw, raisingexpression
as error, happening at the given location in the program.- Parameters:
cfg
- the cfg that this statement belongs tolocation
- the location where the expression is defined within the programexpression
- the expression to raise as error
-
-
Method Detail
-
compareSameClassAndParams
protected int compareSameClassAndParams(Statement o)
Description copied from class:NaryStatement
Auxiliary method forStatement.compareTo(Statement)
that can safely assume that the two statements happen at the sameCodeLocation
, are instances of the same class, and have the same parameters according to their implementation ofStatement.compareTo(Statement)
.- Specified by:
compareSameClassAndParams
in classNaryStatement
- Parameters:
o
- the other statement- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
-
stopsExecution
public boolean stopsExecution()
Description copied from class:Statement
Whether or not this statement stops the execution of the containing cfg, either by throwing an error or returning a value. To distinguish error-raising halting statements and normal ones, useStatement.throwsError()
.- Overrides:
stopsExecution
in classStatement
- Returns:
true
only if that condition holds
-
throwsError
public boolean throwsError()
Description copied from class:Statement
Whether or not this statement throws an error, halting the normal execution of the containing cfg.- Overrides:
throwsError
in classStatement
- Returns:
true
only if that condition holds
-
fwdUnarySemantics
public <A extends AbstractState<A>> AnalysisState<A> fwdUnarySemantics(InterproceduralAnalysis<A> interprocedural, AnalysisState<A> state, SymbolicExpression expr, StatementStore<A> expressions) throws SemanticException
Description copied from class:UnaryStatement
Computes the forward semantics of the statement, after the semantics of the sub-expression has been computed. Meta variables from the sub-expression will be forgotten after this statement returns.- Specified by:
fwdUnarySemantics
in classUnaryStatement
- Type Parameters:
A
- the type ofAbstractState
- Parameters:
interprocedural
- the interprocedural analysis of the program to analyzestate
- the state where the statement is to be evaluatedexpr
- the symbolic expressions representing the computed value of the sub-expression of this expressionexpressions
- the cache where analysis states of intermediate expressions are stored and that can be accessed to query for post-states of parameters expressions- Returns:
- the
AnalysisState
representing the abstract result of the execution of this statement - Throws:
SemanticException
- if something goes wrong during the computation
-
-