public void Compile() { if (_statements.Count == 0 || !(_statements[_statements.Count - 1] is ReturnExpression)) { if (_ctx.ReturnType != typeof(void)) { throw new InvalidOperationException("Non void method body last expression is not return expression"); } AddStatement(Expr.Return()); } _ctx.Compile(_statements); }