跳到內容

runtimetypes

本頁內容尚未翻譯。

def RuntimeTypes.target (t : TypeSyntax) : Option String

The class a dynamic_cast’s target type names, if it is a pointer or reference to one.

def RuntimeTypes.targets (items : List Item) : List String

The classes the items’ dynamic_casts name, each once (a program that casts to none costs nothing more).

def RuntimeTypes.usesTypeid (items : List Item) : Bool

Whether the items use typeid.

def RuntimeTypes.asksDynamicType (items : List Item) : Bool

Whether the items use typeid of an expression (whose dynamic type may be asked).

def RuntimeTypes.castsReference (items : List Item) : Bool

Whether the items dynamic_cast to a reference.

def RuntimeTypes.casterName (s : String) (d : String) (byReference : Bool) : String

The name of S’s cast to D (by pointer, or by reference).

def RuntimeTypes.namerName (s : String) : String

The name of S’s function naming the complete object’s class.

def RuntimeTypes.uniqueBase (known : List ClassMembers) (x : String) (y : String) : Bool

Whether a class has exactly one subobject of a class (or is it): paths reaching one virtual base’s subobject are one.

def RuntimeTypes.dynamicField (all : List ClassMembers) (s : String) (n : NodeId) (root : List Nat) : Expr

The dynamic type’s field of this (of class s) for its own chain (its root at a path).

def RuntimeTypes.onChain (all : List ClassMembers) (s : String) (root : List Nat) : List (Nat * (String * Nat))

The contexts with a class S on their chain: each context’s number, its complete object’s class, and whether S is the complete object itself.

def RuntimeTypes.complete (all : List ClassMembers) (n : NodeId) (x : String) (depth : Nat) (this : Expr) : Expr

The complete object (of class x) of the subobject this points to, depth levels below it: this itself at no depth; up through a virtual base by the internal call that reaches it, else by a cast.

def RuntimeTypes.caster (all : List ClassMembers) (s : String) (d : String) (root : List Nat) : Item

D *S::#cast:D(S *this): null for null, else the complete object as a D where it is one (or has one D), else null.

def RuntimeTypes.referenceCaster (s : String) (d : String) : Item

D &S::#castRef:D(S *this): the pointer’s cast, std::bad_cast thrown where it is null.

def RuntimeTypes.className (x : String) : String

The Itanium C++ ABI’s name of a class (a namespace’s as nested names).

def RuntimeTypes.namer (all : List ClassMembers) (s : String) (root : List Nat) : Item

const char *S::#typeName(S *this): the complete object’s class’s name; std::bad_typeid for null.

def RuntimeTypes.related (all : List ClassMembers) (s : String) (d : String) : Bool

Whether two classes have a class derived from both (or one is the other’s base): a cast between them can find an object.

def RuntimeTypes.functionsUsed (items : List Item) : List Item

The casts and namers, for a program that uses dynamic_cast or typeid.

def RuntimeTypes.functions (items : List Item) : List Item

The casts and namers of the polymorphic classes, for the targets the items name (and typeid’s when it is used).

def RuntimeTypes.chosenName : String

The call name() returns its string through: noting that the string is the implementation’s ([type.info]p9).

def RuntimeTypes.typeClass : Item

std::type_info’s class: the name kept in #nm; name() (the implementation’s string), == and != (by the names).

def RuntimeTypes.prepare (p : Program) : Program

A program using typeid with std::type_info’s class first.

def RuntimeTypes.classOf (g : Globals Cpp.constructs) (t : Ty Cpp.constructs) : Option ClassMembers

The class a checked expression’s type names, if it is one.

def RuntimeTypes.information (checker : Checker Cpp.constructs) (g : Globals Cpp.constructs) (env : Env Cpp.constructs) (n : NodeId) (name : Expr) : CheckResult Cpp.constructs (Lifted Cpp.constructs)

std::type_info for a name.

def RuntimeTypes.identified (checker : Checker Cpp.constructs) (g : Globals Cpp.constructs) (env : Env Cpp.constructs) (n : NodeId) (a : Expr) (l : Lifted Cpp.constructs) : CheckResult Cpp.constructs (Lifted Cpp.constructs)

typeid(a) given a checked: of a polymorphic class’s lvalue, its complete object’s class (through the class’s namer); else the type’s.

def RuntimeTypes.expression (types : TypeExtension Cpp.constructs) (checker : Checker Cpp.constructs) (g : Globals Cpp.constructs) (env : Env Cpp.constructs) (e : Expr) : Option (CheckResult Cpp.constructs (Lifted Cpp.constructs))

C++’s dynamic_cast and typeid.