private void branchCondition(ExprNode cond, StatementNode trueBranch, StatementNode falseBranch, List <LinearRepresentation> addBeforeEndLabel = null) { cond.AcceptVisit(this); LabelValue trueCond = new LabelValue(LABEL_PREFIX + labelCounter++); LabelValue endCond = new LabelValue(LABEL_PREFIX + labelCounter++); LinearRepresentation gotoCond = new LinearRepresentation(Operation.CondGoto, trueCond, idOrNum); evaluatedExpression.Add(gotoCond); moveExpressionToCode(); if (falseBranch != null) { falseBranch.AcceptVisit(this); } evaluatedExpression.Add(new LinearRepresentation(Operation.Goto, endCond)); evaluatedExpression.Add(new LinearRepresentation(trueCond, Operation.NoOperation)); moveExpressionToCode(); trueBranch.AcceptVisit(this); if (addBeforeEndLabel != null) { evaluatedExpression.AddRange(addBeforeEndLabel); } evaluatedExpression.Add(new LinearRepresentation(endCond, Operation.NoOperation)); moveExpressionToCode(); }