// print this node result register protected string PrintReg(RegisterNode reg) { if (reg == null) { return("_"); } return(reg.Id); }
/// <summary> /// This constructor allows to postpone initialization of non-tree edge (target of unconditional jump after this /// seqence). /// </summary> public SequenceNode(IReadOnlyList <Node> sequence, out Action <Node> nextNodeSetter, RegisterNode value = null) { Sequence = sequence; nextNodeSetter = node => { if (NextNode == null) { NextNode = node; } else { throw new InvalidOperationException("NextNode property is already initialized"); } }; _register = value; if (value == null) { _register = sequence.Last().ResultRegister; } }
// value is the value of the whole sequence public SequenceNode(IReadOnlyList <Node> sequence, Node nextNode, RegisterNode value = null) { Sequence = sequence; NextNode = nextNode; _register = value ?? sequence.Last().ResultRegister; }