compiler/mir/mirchangesets

  Source   Edit

Implements the Changeset type, which is a changeset for MirBody. It builds upon/extends TreeChangeset.

Types

Changeset = object
  inner: TreeChangeset
  locals: PartialStore[LocalId, Local] ## new locals to be added on changeset application
  nextLabel: uint32          ## exchanged with the builder, where it's used for allocating new IDs
  
Represents a set of changes to be applied to a MirBody.   Source   Edit

Procs

func apply(body: var MirBody; c: sink Changeset) {....raises: [], tags: [].}
Applies the changeset c to body.   Source   Edit
func initChangeset(body: MirBody): Changeset {....raises: [], tags: [].}
Sets up a changeset for body. The changeset either needs to be discarded, or applied to the same MirBody instance it was created for.   Source   Edit

Templates

template changeTree(c: var Changeset; tree: MirTree; at: NodePosition;
                    with: MirNode)
Same as changeTree.   Source   Edit
template insert(c: var Changeset; at: NodePosition; n: MirNode)
Same as insert.   Source   Edit
template insert(c: var Changeset; tree: MirTree; at, source: NodePosition;
                name: untyped; body: untyped)
Records an insertion at the at position. For building the new tree, a MirBuilder instance is made available to the provided body via an injected local of name name. source identifies the node to inherit source information from.   Source   Edit
template remove(c: var Changeset; tree: MirTree; at: NodePosition)
Same as remove.   Source   Edit
template replace(c: var Changeset; tree: MirTree; at: NodePosition;
                 with: MirNode)
Same as replace.   Source   Edit
template replaceMulti(c: var Changeset; tree: MirTree; at: NodePosition;
                      name, body: untyped)
Records a replacement of the node or sub-tree at the at position. For building the replacement tree, a MirBuilder instance is made available to the provided body via an injected local of name name.   Source   Edit