Packed AST representation, mostly based on a seq of nodes. For IC support. Far future: Rewrite the compiler passes to use this representation directly in all the transformations, it is superior.
Types
PackedInstantiation = object key*, sym*: PackedItemId concreteTypes*: seq[PackedItemId]
- Source Edit
PackedItemId = object module*: LitId item*: int32
- Source Edit
PackedLib = object kind*: TLibKind generated*: bool isOverridden*: bool name*: LitId path*: NodeId
- Source Edit
PackedLineInfo = object line*: uint16 col*: int16 file*: LitId
- Source Edit
PackedNode = object kind*: TNodeKind flags*: TNodeFlags operand*: int32 typeId*: PackedItemId info*: PackedLineInfo
- Source Edit
PackedSym = object kind*: TSymKind name*: LitId typ*: PackedItemId flags*: TSymFlags magic*: TMagic info*: PackedLineInfo ast*: NodeId owner*: PackedItemId guard*: PackedItemId bitsize*: int alignment*: int options*: TOptions position*: int offset*: int32 disamb*: int32 externalName*: LitId locFlags*: TLocFlags annex*: PackedLib when hasFFI: cname*: LitId constraint*: NodeId
- Source Edit
PackedTree = object nodes*: seq[PackedNode]
- usually represents a full Nim module Source Edit
PackedType = object kind*: TTypeKind callConv*: TCallingConvention flags*: TTypeFlags types*: seq[PackedItemId] n*: NodeId sym*: PackedItemId owner*: PackedItemId size*: BiggestInt align*: int16 paddingAtEnd*: int16 typeInst*: PackedItemId nonUniqueId*: int32
- Source Edit
Consts
directIntLit = nkInt32Lit
- Source Edit
emptyNodeId = -1'i32
- Source Edit
externIntLit = {nkCharLit, nkIntLit, nkInt8Lit, nkInt16Lit, nkInt64Lit, nkUIntLit, nkUInt8Lit, nkUInt16Lit, nkUInt32Lit, nkUInt64Lit}
- Source Edit
externSIntLit = {nkIntLit, nkInt8Lit, nkInt16Lit, nkInt64Lit}
- Source Edit
externUIntLit = {nkUIntLit, nkUInt8Lit, nkUInt16Lit, nkUInt32Lit, nkUInt64Lit}
- Source Edit
Procs
proc `[]`(tree: PackedTree; i: int): lent PackedNode {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc addIdent(tree: var PackedTree; s: LitId; info: PackedLineInfo) {. ...raises: [], tags: [], forbids: [].}
- Source Edit
proc addModuleId(tree: var PackedTree; s: ModuleId; info: PackedLineInfo) {. ...raises: [], tags: [], forbids: [].}
- Source Edit
proc addSym(tree: var PackedTree; s: int32; info: PackedLineInfo) {....raises: [], tags: [], forbids: [].}
- Source Edit
proc addSymDef(tree: var PackedTree; s: SymId; info: PackedLineInfo) {. ...raises: [], tags: [], forbids: [].}
- Source Edit
proc copyTree(dest: var PackedTree; tree: PackedTree; n: NodePos) {....raises: [], tags: [], forbids: [].}
- Source Edit
proc getNodeId(tree: PackedTree): NodeId {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc hasAtLeastXsons(tree: PackedTree; n: NodePos; x: int): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc hasXsons(tree: PackedTree; n: NodePos; x: int): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc info(tree: PackedTree; n: NodePos): PackedLineInfo {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc isAtom(tree: PackedTree; pos: int): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc len(tree: PackedTree): int {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc newTreeFrom(old: PackedTree): PackedTree {....raises: [], tags: [], forbids: [].}
- Source Edit
proc patch(tree: var PackedTree; pos: PatchPos) {....raises: [], tags: [], forbids: [].}
- Source Edit
proc prepare(dest: var PackedTree; source: PackedTree; sourcePos: NodePos): PatchPos {. ...raises: [], tags: [], forbids: [].}
- Source Edit
proc prepare(tree: var PackedTree; kind: TNodeKind; flags: TNodeFlags; typeId: PackedItemId; info: PackedLineInfo): PatchPos {....raises: [], tags: [], forbids: [].}
- Source Edit
proc span(tree: PackedTree; pos: int): int {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc throwAwayLastNode(tree: var PackedTree) {....raises: [], tags: [], forbids: [].}
- Source Edit
proc toPackedItemId(item: int32): PackedItemId {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
Iterators
iterator allNodes(tree: PackedTree): NodePos {....raises: [], tags: [], forbids: [].}
- Source Edit
iterator isons(dest: var PackedTree; tree: PackedTree; n: NodePos): (int, NodePos) {....raises: [], tags: [], forbids: [].}
- Source Edit
iterator sons(dest: var PackedTree; tree: PackedTree; n: NodePos): NodePos {. ...raises: [], tags: [], forbids: [].}
- Source Edit
iterator sonsReadonly(tree: PackedTree; n: NodePos): NodePos {....raises: [], tags: [], forbids: [].}
- Source Edit
iterator sonsWithoutLast2(tree: PackedTree; n: NodePos): NodePos {....raises: [], tags: [], forbids: [].}
- Source Edit
Templates
template copyIntoKind(dest, kind, info, body)
- Source Edit
template flags(n: NodePos): TNodeFlags
- Source Edit
template info(n: NodePos): PackedLineInfo
- Source Edit
template typ(n: NodePos): PackedItemId
- Source Edit