Go to the previous, next section.

Parent Tree Nodes

Each instruction automatically records the tree_instr node to which it is attached. The parent method retrieves this pointer. In an expression tree, all of the instructions share the same parent tree_instr node, so an instruction may not be directly connected to its parent node.

The owner method is identical to the parent method except for instructions that are used as operands of tree_for nodes. Those operands are actually attached to dummy copy instructions on lists attached to the tree_for nodes (see section For Nodes), but many users will want to treat them as if they are directly attached to the tree_for nodes. Thus, for an instruction in a tree_for operand, the owner method will return a pointer to the tree_for node instead of returning the actual parent tree_instr. This only works if the tree_for operand list contains a single expression (not a flat list); otherwise, the actual tree_instr parent is returned.

Go to the previous, next section.