summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parse.y8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/parse.y b/src/parse.y
index 217e82a37..63d39ec5f 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -4847,13 +4847,17 @@ load_exec(mrb_state *mrb, parser_state *p)
{
int n;
- if (!p || !p->tree || p->nerr) {
+ if (!p) {
+ mrb_pool_close(p->pool);
+ return mrb_nil_value();
+ }
+ if (p->capture_errors && (!p->tree || p->nerr)) {
char buf[256];
n = snprintf(buf, sizeof(buf), "line %d: %s\n",
p->error_buffer[0].lineno, p->error_buffer[0].message);
- mrb_pool_close(p->pool);
mrb->exc = (struct RObject*)mrb_object(mrb_exc_new(mrb, E_SYNTAX_ERROR, buf, n));
+ mrb_pool_close(p->pool);
return mrb_nil_value();
}
n = mrb_generate_code(mrb, p->tree);