types
code owner: Arne Döring e-mail: [email protected] included from types.nim
Imports
Types
TPreferedDesc = enum preferName, preferDesc, preferExported, preferModuleInfo, preferGenericArg, preferTypeName, preferResolved, preferMixed
- Source Edit
TTypeIter = proc (t: PType; closure: RootRef): bool {...}{.nimcall.}
- Source Edit
TTypeMutator = proc (t: PType; closure: RootRef): PType {...}{.nimcall.}
- Source Edit
TTypePredicate = proc (t: PType): bool {...}{.nimcall.}
- Source Edit
TParamsEquality = enum paramsNotEqual, paramsEqual, paramsIncompatible
- Source Edit
TTypeFieldResult = enum frNone, frHeader, frEmbedded
- Source Edit
TDistinctCompare = enum dcEq, ## a and b should be the same type dcEqIgnoreDistinct, ## compare symmetrically: (distinct a) == b, a == b ## or a == (distinct b) dcEqOrDistinctOf ## a equals b or a is distinct of b
- how distinct types are to be compared Source Edit
TTypeCmpFlag = enum IgnoreTupleFields, ## NOTE: Only set this flag for backends! IgnoreCC, ExactTypeDescValues, ExactGenericParams, ExactConstraints, ExactGcSafety, AllowCommonBase
- Source Edit
TTypeCmpFlags = set[TTypeCmpFlag]
- Source Edit
EffectsCompat = enum efCompat, efRaisesDiffer, efRaisesUnknown, efTagsDiffer, efTagsUnknown, efLockLevelsDiffer
- Source Edit
OrdinalType = enum NoneLike, IntLike, FloatLike
- Source Edit
Consts
abstractPtrs = {tyVar, tyPtr, tyRef, tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias, tyInferred, tySink, tyLent, tyOwned}
- Source Edit
abstractVar = {tyVar, tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias, tyInferred, tySink, tyLent, tyOwned}
- Source Edit
abstractRange = {tyGenericInst, tyRange, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias, tyInferred, tySink, tyOwned}
- Source Edit
abstractInst = {tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc, tyAlias, tyInferred, tySink, tyOwned}
- Source Edit
abstractInstOwned = {tyAlias, tyTypeDesc, tyGenericInst, tyDistinct, tyOrdinal, tyOwned..tySink, tyInferred}
- Source Edit
skipPtrs = {tyVar, tyPtr, tyRef, tyGenericInst, tyTypeDesc, tyAlias, tyInferred, tySink, tyLent, tyOwned}
- Source Edit
typedescPtrs = {tyAlias, tyTypeDesc, tyGenericInst, tyDistinct, tyOrdinal, tyPtr..tyVar, tyOwned..tyLent, tyInferred}
- Source Edit
typedescInst = {tyAlias, tyTypeDesc, tyGenericInst, tyDistinct, tyOrdinal, tyOwned..tySink, tyUserTypeClass, tyInferred}
- Source Edit
szUnknownSize = -3
- Source Edit
szIllegalRecursion = -2
- Source Edit
szUncomputedSize = -1
- Source Edit
szTooBigSize = -4
- Source Edit
Procs
proc base(t: PType): PType {...}{.raises: [], tags: [].}
- Source Edit
proc invalidGenericInst(f: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc isPureObject(typ: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc isUnsigned(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc getOrdValue(n: PNode; onError = high(Int128)): Int128 {...}{.raises: [], tags: [].}
- Source Edit
proc getFloatValue(n: PNode): BiggestFloat {...}{.raises: [], tags: [].}
- Source Edit
proc isIntLit(t: PType): bool {...}{.inline, raises: [], tags: [].}
- Source Edit
proc isFloatLit(t: PType): bool {...}{.inline, raises: [], tags: [].}
- Source Edit
proc addTypeHeader(result: var string; conf: ConfigRef; typ: PType; prefer: TPreferedDesc = preferMixed; getDeclarationPath = true) {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc getProcHeader(conf: ConfigRef; sym: PSym; prefer: TPreferedDesc = preferName; getDeclarationPath = true): string {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc elemType(t: PType): PType {...}{.raises: [], tags: [].}
- Source Edit
proc enumHasHoles(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc isOrdinalType(t: PType; allowEnumWithHoles: bool = false): bool {...}{. raises: [], tags: [].}
- Source Edit
proc iterOverType(t: PType; iter: TTypeIter; closure: RootRef): bool {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc searchTypeFor(t: PType; predicate: TTypePredicate): bool {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc containsObject(t: PType): bool {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc analyseObjectWithTypeField(t: PType): TTypeFieldResult {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc containsGarbageCollectedRef(typ: PType): bool {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc containsManagedMemory(typ: PType): bool {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc containsTyRef(typ: PType): bool {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc containsHiddenPointer(typ: PType): bool {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc isFinal(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc canFormAcycle(typ: PType): bool {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc mutateType(t: PType; iter: TTypeMutator; closure: RootRef): PType {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc typeToString(typ: PType; prefer: TPreferedDesc = preferName): string {...}{. raises: [Exception, ValueError], tags: [RootEffect].}
- Source Edit
proc firstOrd(conf: ConfigRef; t: PType): Int128 {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc firstFloat(t: PType): BiggestFloat {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc lastOrd(conf: ConfigRef; t: PType): Int128 {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc lastFloat(t: PType): BiggestFloat {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc floatRangeCheck(x: BiggestFloat; t: PType): bool {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc lengthOrd(conf: ConfigRef; t: PType): Int128 {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc sameType(a, b: PType; flags: TTypeCmpFlags = {}): bool {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc sameTypeOrNil(a, b: PType; flags: TTypeCmpFlags = {}): bool {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc equalParams(a, b: PNode): TParamsEquality {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc sameObjectTypes(a, b: PType): bool {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc sameDistinctTypes(a, b: PType): bool {...}{.inline, raises: [Exception], tags: [RootEffect].}
- Source Edit
proc sameEnumTypes(a, b: PType): bool {...}{.inline, raises: [], tags: [].}
- Source Edit
proc isGenericAlias(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc skipGenericAlias(t: PType): PType {...}{.raises: [], tags: [].}
- Source Edit
proc sameFlags(a, b: PType): bool {...}{.inline, raises: [], tags: [].}
- Source Edit
proc sameBackendType(x, y: PType): bool {...}{. raises: [Exception, ERecoverableError], tags: [RootEffect].}
- Source Edit
proc compareTypes(x, y: PType; cmp: TDistinctCompare = dcEq; flags: TTypeCmpFlags = {}): bool {...}{. raises: [Exception, ERecoverableError], tags: [RootEffect].}
- compares two type for equality (modulo type distinction) Source Edit
proc inheritanceDiff(a, b: PType): int {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc commonSuperclass(a, b: PType): PType {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc matchType(a: PType; pattern: openArray[tuple[k: TTypeKind, i: int]]; last: TTypeKind): bool {...}{.raises: [], tags: [].}
- Source Edit
proc computeSize(conf: ConfigRef; typ: PType): BiggestInt {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc getReturnType(s: PSym): PType {...}{.raises: [], tags: [].}
- Source Edit
proc getAlign(conf: ConfigRef; typ: PType): BiggestInt {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc getSize(conf: ConfigRef; typ: PType): BiggestInt {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc containsGenericType(t: PType): bool {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc baseOfDistinct(t: PType): PType {...}{.raises: [], tags: [].}
- Source Edit
proc safeInheritanceDiff(a, b: PType): int {...}{.raises: [Exception], tags: [RootEffect].}
- Source Edit
proc compatibleEffects(formal, actual: PType): EffectsCompat {...}{. raises: [Exception], tags: [RootEffect].}
- Source Edit
proc isCompileTimeOnly(t: PType): bool {...}{.inline, raises: [], tags: [].}
- Source Edit
proc containsCompileTimeOnly(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc safeSkipTypes(t: PType; kinds: TTypeKinds): PType {...}{.raises: [], tags: [].}
- same as 'skipTypes' but with a simple cycle detector. Source Edit
proc classify(t: PType): OrdinalType {...}{.raises: [], tags: [].}
- for convenient type checking: Source Edit
proc skipConv(n: PNode): PNode {...}{.raises: [], tags: [].}
- Source Edit
proc skipHidden(n: PNode): PNode {...}{.raises: [], tags: [].}
- Source Edit
proc skipConvTakeType(n: PNode): PNode {...}{.raises: [], tags: [].}
- Source Edit
proc isEmptyContainer(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc takeType(formal, arg: PType): PType {...}{.raises: [], tags: [].}
- Source Edit
proc skipHiddenSubConv(n: PNode): PNode {...}{.raises: [], tags: [].}
- Source Edit
proc typeMismatch(conf: ConfigRef; info: TLineInfo; formal, actual: PType) {...}{. raises: [Exception, ValueError, IOError, ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
- Source Edit
proc isTupleRecursive(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc isException(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc isDefectException(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
proc isSinkTypeForParam(t: PType): bool {...}{.raises: [], tags: [].}
- Source Edit
Templates
template `$`(typ: PType): string
- Source Edit
template bindConcreteTypeToUserTypeClass(tc, concrete: PType)
- Source Edit
template isResolvedUserTypeClass(t: PType): bool
- Source Edit
template foldSizeOf(conf: ConfigRef; n: PNode; fallback: PNode): PNode
- Source Edit
template foldAlignOf(conf: ConfigRef; n: PNode; fallback: PNode): PNode
- Source Edit
template foldOffsetOf(conf: ConfigRef; n: PNode; fallback: PNode): PNode
- Returns an int literal node of the given offsetof expression in
n
. Falls back tofallback
, if theoffsetof
expression can't be processed. Source Edit
© 2006–2021 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compiler/types.html