private void generateSwitch(SwitchNode node)
            throws IRException {

        try {
            scopes.enterBlock();

            Operand expr = generate(node.expression);

            csi.renew();
            Label defaultLabel = new Label();

            for(CaseNode c : node.cases) {
                Label caseL = new Label();

                Operand caseExpr = generate(c.expression);

                TmpVariableOperand condition =
                    new TmpVariableOperand(
                        new PrimitiveType(PrimitiveType.Type.BOOL),
                        varTable
                    );

                code.addStatement(
                    new BinaryOperationStatement(
                        expr,
                        caseExpr,
                        condition,
                        BinaryOperationStatement.Operation.EQUAL)
                );

                code.addStatement(
                    new IfGoToStatement(condition, caseL, defaultLabel)
                );

                caseL.setIndex(code.nextIndex());

                generate(c.block);

                code.addStatement(new GoToStatement(defaultLabel));
            }

            if(node.defaultNode != null) {
                defaultLabel.setIndex(code.nextIndex());

                generate(node.defaultNode.block);
                csi.endOfBlockLabel.setIndex(code.nextIndex());
            } else {
                csi.endOfBlockLabel.setIndex(code.nextIndex());
                defaultLabel.setIndex(code.nextIndex());
            }

            scopes.leaveBlock();
        } catch(IRException ex) {
            throw ex;
        } catch(Exception ex) {
            throw (NonGenerationException)new NonGenerationException(ex)
                    .Log("ru.bmstu.iu9.compiler.ir");
        }
    }