private void generateFunction(FunctionDeclNode node) throws IRException {
        try {

            returnLabel = new Label();
            code = new Code();
            codes.add(code);

            scopes.enterBlock();

            FunctionType type = (FunctionType) node.realType();
            for(FunctionType.Argument arg : type.arguments) {
                varTable.add(new NamedVariable(arg.name, arg.type));
            }

            for(ru.bmstu.iu9.compiler.syntax.tree.Statement n : node.block) {
                try {
                    generate(n.getNode());
                } catch (IRException ex) {
                    continue;
                }
            }

            returnLabel.setIndex(code.nextIndex());

            if (returnValue != null)
                code.addStatement(new ReturnStatement(returnValue));
            else
                code.addStatement(new ReturnStatement());

            scopes.leaveBlock();

            code.print();
        } catch(Exception ex) {
            throw (NonGenerationException)new NonGenerationException(ex)
                    .Log("ru.bmstu.iu9.compiler.ir");
        }
    }