Package it.unive.lisa.analysis
Interface ScopedObject<T>
-
- Type Parameters:
T
- the concrete type of this object, returned by push and pop operations
- All Known Subinterfaces:
AbstractState<A>
,BaseHeapDomain<H>
,DataflowElement<D,E>
,HeapDomain<D>
,SemanticDomain<D,E,I>
,TypeDomain<T>
,ValueDomain<D>
- All Known Implementing Classes:
AccessChild
,AnalysisState
,BinaryExpression
,Constant
,DataflowDomain
,DefiniteDataflowDomain
,Environment
,ExpressionInverseSet
,ExpressionSet
,HeapDereference
,HeapEnvironment
,HeapExpression
,HeapLocation
,HeapReference
,Identifier
,InferenceSystem
,MemoryAllocation
,MemoryPointer
,NullConstant
,OutOfScopeIdentifier
,PossibleDataflowDomain
,PushAny
,PushInv
,Skip
,SymbolicExpression
,TernaryExpression
,TypeEnvironment
,UnaryExpression
,ValueEnvironment
,ValueExpression
,Variable
,VariableLift
public interface ScopedObject<T>
An object that can react to the introduction or removal of scopes, modifying the variables currently in view. Scoping happens throughpushScope(ScopeToken)
andpopScope(ScopeToken)
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
popScope(ScopeToken token)
Pops the scope identified by the given token from this object.T
pushScope(ScopeToken token)
Pushes a new scope, identified by the give token, in this object.
-
-
-
Method Detail
-
pushScope
T pushScope(ScopeToken token) throws SemanticException
Pushes a new scope, identified by the give token, in this object. This causes all variables not associated with a scope (and thus visible) to be mapped to the given scope and hidden away, until the scope is popped withpopScope(ScopeToken)
.- Parameters:
token
- the token identifying the scope to push- Returns:
- a copy of this object where the local unscoped variables have been hidden
- Throws:
SemanticException
- if an error occurs during the computation
-
popScope
T popScope(ScopeToken token) throws SemanticException
Pops the scope identified by the given token from this object. This causes all the visible variables (i.e. that are not mapped to a scope) to be removed, while the local variables that were associated to the given scope token (and thus hidden) will become visible again.- Parameters:
token
- the token of the scope to be restored- Returns:
- a copy of this object where the local variables have been removed, while the variables mapped to the given scope are visible again
- Throws:
SemanticException
- if an error occurs during the computation
-
-