Package org.sonar.javascript.se
Class ExpressionStack
- java.lang.Object
-
- org.sonar.javascript.se.ExpressionStack
-
public class ExpressionStack extends Object
This class stores the stack of symbolic values corresponding to the order of expression evaluation. EachProgramStatehas corresponding instance ofExpressionStack. Note that this class is immutable.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressionStackapply(Consumer<Deque<SymbolicValue>> action)This method allows to perform one or more operations on a copy of the internal stack.static ExpressionStackemptyStack()booleanequals(Object obj)ExpressionStackexecute(ExpressionTree expression, ProgramStateConstraints constraints)This method executes expression: it pushes to the stack a new symbolic value based (if required) on popped symbolic values.inthashCode()booleanisEmpty()SymbolicValuepeek()SymbolicValuepeek(int n)ExpressionStackpush(SymbolicValue newValue)ExpressionStackremoveLastValue()intsize()StringtoString()
-
-
-
Method Detail
-
emptyStack
public static ExpressionStack emptyStack()
-
push
public ExpressionStack push(SymbolicValue newValue)
-
execute
public ExpressionStack execute(ExpressionTree expression, ProgramStateConstraints constraints)
This method executes expression: it pushes to the stack a new symbolic value based (if required) on popped symbolic values. Note that asExpressionStackis an immutable class, this method will return new resulting instance ofExpressionStackwhile the calling this method instance will not be changed.- Parameters:
expression- to be executedconstraints-- Returns:
- resulting
ExpressionStack
-
peek
public SymbolicValue peek()
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
peek
public SymbolicValue peek(int n)
-
removeLastValue
public ExpressionStack removeLastValue()
-
apply
public ExpressionStack apply(Consumer<Deque<SymbolicValue>> action)
This method allows to perform one or more operations on a copy of the internal stack. It thus guarantees ExpressionStack immutability.- Parameters:
action- the operation to perform on the internal stack- Returns:
- a new instance of ExpressionStack containing the copy of the internal stack modified by the operation
-
-