Package org.sonar.javascript.se
Class ProgramState
- java.lang.Object
-
- org.sonar.javascript.se.ProgramState
-
- All Implemented Interfaces:
ProgramStateConstraints
public class ProgramState extends Object implements ProgramStateConstraints
This class represents the knowledge about the variables values. The same program state may be valid for several program points and at one program point there might be valid several program states (depending on execution path). This class is immutable.
-
-
Method Summary
-
-
-
Method Detail
-
values
public com.google.common.collect.ImmutableMap<Symbol,SymbolicValue> values()
-
emptyState
public static ProgramState emptyState()
-
newSymbolicValue
public ProgramState newSymbolicValue(Symbol symbol, @Nullable Constraint constraint)
-
newFunctionSymbolicValue
public ProgramState newFunctionSymbolicValue(Symbol symbol, FunctionTree functionTree)
-
constrain
public Optional<ProgramState> constrain(@Nullable SymbolicValue value, @Nullable Constraint constraint)
-
getSymbolicValue
@CheckForNull public SymbolicValue getSymbolicValue(@Nullable Symbol symbol)
-
getConstraint
public Constraint getConstraint(@Nullable SymbolicValue value)
- Specified by:
getConstraintin interfaceProgramStateConstraints
-
getConstraint
public Constraint getConstraint(@Nullable Symbol symbol)
-
pushToStack
public ProgramState pushToStack(SymbolicValue value)
-
removeLastValue
public ProgramState removeLastValue()
-
clearStack
public ProgramState clearStack(Tree element)
-
assertEmptyStack
public void assertEmptyStack(Tree element)
-
execute
public ProgramState execute(ExpressionTree expression)
-
withStack
public ProgramState withStack(ExpressionStack newStack)
-
assignment
public ProgramState assignment(Symbol variable)
-
assignment
public ProgramState assignment(Symbol variable, SymbolicValue value)
-
addRelation
public ProgramState addRelation(Relation relation)
-
peekStack
public SymbolicValue peekStack()
-
peekStack
public SymbolicValue peekStack(int n)
-
removeSymbols
public ProgramState removeSymbols(Set<Symbol> symbolsToKeep)
-
getStack
@Deprecated public ExpressionStack getStack()
Deprecated.Temporary method
-
getSymbolicValue
@Nullable public SymbolicValue getSymbolicValue(IdentifierTree identifier, SymbolicExecution execution)
-
-