Exemplo n.º 1
0
        public void ProcessStatementIf(DMASTProcStatementIf statement)
        {
            DMExpression.Emit(_dmObject, _proc, statement.Condition);

            if (statement.ElseBody == null)
            {
                string endLabel = _proc.NewLabelName();

                _proc.JumpIfFalse(endLabel);
                _proc.StartScope();
                ProcessBlockInner(statement.Body);
                _proc.EndScope();
                _proc.AddLabel(endLabel);
            }
            else
            {
                string elseLabel = _proc.NewLabelName();
                string endLabel  = _proc.NewLabelName();

                _proc.JumpIfFalse(elseLabel);

                _proc.StartScope();
                ProcessBlockInner(statement.Body);
                _proc.EndScope();
                _proc.Jump(endLabel);

                _proc.AddLabel(elseLabel);
                ProcessBlockInner(statement.ElseBody);
                _proc.AddLabel(endLabel);
            }
        }
Exemplo n.º 2
0
        public void VisitProcStatementIf(DMASTProcStatementIf statementIf)
        {
            SimplifyExpression(ref statementIf.Condition);

            statementIf.Body?.Visit(this);
            statementIf.ElseBody?.Visit(this);
        }
Exemplo n.º 3
0
        public void VisitProcStatementIf(DMASTProcStatementIf statementIf)
        {
            SimplifyExpression(ref statementIf.Condition);

            if (statementIf.Body != null)
            {
                statementIf.Body.Visit(this);
            }
            if (statementIf.ElseBody != null)
            {
                statementIf.ElseBody.Visit(this);
            }
        }