Esempio n. 1
0
        public void Combine()
        {
            var conditionalJumpNode = new ConditionalJumpNode();
            var jumpBackNode = new JumpNode();

            _compiledStatement.AddLast(new DoNothingNode());
            LinkedListExtensions.AppendRange(_compiledStatement, _condition.AsEnumerable<ActionNode>());
            _compiledStatement.AddLast(conditionalJumpNode); // De body komt dus rechtstreeks na de conditionalJumpNode (dus op de .Next property)
            LinkedListExtensions.AppendRange(_compiledStatement, _body.AsEnumerable<ActionNode>());
            _compiledStatement.AddLast(jumpBackNode);
            _compiledStatement.AddLast(new DoNothingNode());

            jumpBackNode.JumpToNode = _compiledStatement.First; // JumpToNode is een extra property ten opzichte van andere nodes.
            conditionalJumpNode.NextOnTrue = _body.First; // NextOnTrue en NextOnFalse zijn extra properties ten opzichte van andere nodes.
            conditionalJumpNode.NextOnFalse = _compiledStatement.Last;
        }
Esempio n. 2
0
        public void Combine()
        {
            var conditionalJumpNode = new ConditionalJumpNode();
            var jumpNode = new JumpNode();

            _compiledStatement.AddLast(new DoNothingNode());
            LinkedListExtensions.AppendRange(_compiledStatement, _condition.AsEnumerable<ActionNode>());
            _compiledStatement.AddLast(conditionalJumpNode);
            LinkedListExtensions.AppendRange(_compiledStatement, _bodyIf.AsEnumerable<ActionNode>());
            if (_bodyElse.First != null)
                _compiledStatement.AddLast(jumpNode);
            LinkedListExtensions.AppendRange(_compiledStatement, _bodyElse.AsEnumerable<ActionNode>());
            _compiledStatement.AddLast(new DoNothingNode());
            jumpNode.JumpToNode = _compiledStatement.Last;

            conditionalJumpNode.NextOnTrue = _bodyIf.First;
            conditionalJumpNode.NextOnFalse = _bodyElse.First;
        }
Esempio n. 3
0
 public override void Visit(JumpNode node)
 {
     NextNode = node.JumpToNode;
 }
Esempio n. 4
0
 public abstract void Visit(JumpNode node);