summaryrefslogtreecommitdiffhomepage
path: root/src/parse.y
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-03-04 08:37:38 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-03-04 08:37:38 +0900
commita3411c4c96c5975680b7198364127b19472cb20a (patch)
tree5b70358a37a209a21eb716ec60233e330a8a20bc /src/parse.y
parente1b3cfa88e6043c6b9c21a944e40cc888f02bb0f (diff)
parent019d15c3eedb0fdb9412a3b67180da368c74bdd1 (diff)
downloadmruby-a3411c4c96c5975680b7198364127b19472cb20a.tar.gz
mruby-a3411c4c96c5975680b7198364127b19472cb20a.zip
Merge pull request #1789 from cubicdaiya/feature/mrb_exc_new_str_lit
Introduce mrb_exc_new_str_lit for C string literals
Diffstat (limited to 'src/parse.y')
-rw-r--r--src/parse.y7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/parse.y b/src/parse.y
index 5e81e5536..b82b3e271 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -24,6 +24,7 @@
#include "mruby.h"
#include "mruby/compile.h"
#include "mruby/proc.h"
+#include "mruby/error.h"
#include "node.h"
#include "mrb_throw.h"
@@ -5398,8 +5399,7 @@ load_exec(mrb_state *mrb, parser_state *p, mrbc_context *c)
return mrb_undef_value();
}
else {
- static const char msg[] = "syntax error";
- mrb->exc = mrb_obj_ptr(mrb_exc_new(mrb, E_SYNTAX_ERROR, msg, sizeof(msg) - 1));
+ mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SYNTAX_ERROR, "syntax error"));
mrb_parser_free(p);
return mrb_undef_value();
}
@@ -5407,8 +5407,7 @@ load_exec(mrb_state *mrb, parser_state *p, mrbc_context *c)
proc = mrb_generate_code(mrb, p);
mrb_parser_free(p);
if (proc == NULL) {
- static const char msg[] = "codegen error";
- mrb->exc = mrb_obj_ptr(mrb_exc_new(mrb, E_SCRIPT_ERROR, msg, sizeof(msg) - 1));
+ mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SCRIPT_ERROR, "codegen error"));
return mrb_undef_value();
}
if (c) {