From aee1476ebdafd842f9805b470996f4882eb5b6d9 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 28 Jun 2017 16:04:40 +0900 Subject: Provide better way to check compile errors. Now you can just call `mrb_load_*` functions then check `context->parser_nerr > 0` if the return value is `undef`, instead of calling `mrb_parse_*` functions independently. ref #3248 #3331 --- mrbgems/mruby-compiler/core/parse.y | 1 + 1 file changed, 1 insertion(+) (limited to 'mrbgems/mruby-compiler') diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 1266bb8f5..76f1ceb2b 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -5777,6 +5777,7 @@ mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c) return mrb_undef_value(); } if (!p->tree || p->nerr) { + c->parser_nerr = p->nerr; if (p->capture_errors) { char buf[256]; int n; -- cgit v1.2.3