qtil
advanced-security/qtil-swift 0.0.3
Search

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.Instance

Classes

Type

A convenience base class that is an instanceof the type T.

Parameters