Adds documentation on skipTypes and mapType
This commit is contained in:
parent
e46a735bb5
commit
f8ea5f1a37
2 changed files with 5 additions and 0 deletions
|
|
@ -1313,6 +1313,10 @@ proc newSons(father: PNode, length: int) =
|
||||||
setLen(father.sons, length)
|
setLen(father.sons, length)
|
||||||
|
|
||||||
proc skipTypes*(t: PType, kinds: TTypeKinds): PType =
|
proc skipTypes*(t: PType, kinds: TTypeKinds): PType =
|
||||||
|
## Used throughout the compiler code to test whether a type tree contains or
|
||||||
|
## doesn't contain a specific type/types - it is often the case that only the
|
||||||
|
## last child nodes of a type tree need to be searched. This is a really hot
|
||||||
|
## path within the compiler!
|
||||||
result = t
|
result = t
|
||||||
while result.kind in kinds: result = lastSon(result)
|
while result.kind in kinds: result = lastSon(result)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ proc mapSetType(typ: PType): TCTypeKind =
|
||||||
else: result = ctArray
|
else: result = ctArray
|
||||||
|
|
||||||
proc mapType(typ: PType): TCTypeKind =
|
proc mapType(typ: PType): TCTypeKind =
|
||||||
|
## Maps a nimrod type to a C type
|
||||||
case typ.kind
|
case typ.kind
|
||||||
of tyNone, tyStmt: result = ctVoid
|
of tyNone, tyStmt: result = ctVoid
|
||||||
of tyBool: result = ctBool
|
of tyBool: result = ctBool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue