Module Instance
A module to make it more convenient to use instanceof inheritance in QL, by providing a
convenience cast member, and inheriting toString() from the instance type.
To use this module, instead of declaring instanceof T, declare extend Instance<T>::Type and
then use the inst() member to access members on the base class T.
Example usage:
class MyExpr extends Instance<Expr>::Type {
predicate isConstant() { inst().isConstant() }
}
// is equivalent to:
class MyExpr2 instanceof Expr {
string toString() { result = this.(Expr).toString() }
predicate isConstant() {this.(Expr).isConstant() }
}
For using instanceof inheritance with infinite types, use the InfInstance module instead, as
additional bindingset declarations are required to support infinite types.
Import path
import qtil.inheritance.InstanceClasses
| Type | A convenience base class that is an |