compiler/mir/typemaps

  Source   Edit

Implements a Table-like type for mapping a PType to some value. The PType keys undergo basic canoncalization, meaning that two different - in terms of reference equality - PType instances can represent the same key.

The canonicalization makes sure to not ignore type information relevant to the mid-end and code generation stages.

Types

TypeTable[T] = object
  inner: Table[Type, T]
  Source   Edit

Procs

func `==`(a, b: Type): bool {.inline, ...raises: [Exception], tags: [RootEffect].}
Leaked implementation detail -- do not use.   Source   Edit
proc `[]=`[T](t: var TypeTable[T]; key: PType; val: sink T) {.inline.}
Assign a val for the key.   Source   Edit
proc `[]`[T](t: TypeTable[T]; key: PType): T {.inline.}
Looks up the item for key.   Source   Edit
proc getOrDefault[T](t: TypeTable[T]; key: PType; def: T): T
If there's a value for key in t, returns it, def otherwise.   Source   Edit
func hash(x: Type): Hash {.inline, ...raises: [], tags: [].}
Leaked implementation detail -- do not use.   Source   Edit
proc mgetOrPut[T](t: var TypeTable; key: PType; val: T): var T
If key has no mapping in t, adds one with val as the value first.   Source   Edit