Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
b9f771dc
Commit
b9f771dc
authored
Jun 07, 2017
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handles exceptions from code generation phase; fix #3695
parent
fc7096f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
+4
-1
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+4
-0
mrbgems/mruby-compiler/core/parse.y
mrbgems/mruby-compiler/core/parse.y
+6
-3
No files found.
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
View file @
b9f771dc
...
...
@@ -236,7 +236,10 @@ main(int argc, char **argv)
mrb_gc_arena_restore
(
mrb
,
ai
);
mrbc_context_free
(
mrb
,
c
);
if
(
mrb
->
exc
)
{
if
(
!
mrb_undef_p
(
v
))
{
if
(
mrb_undef_p
(
v
))
{
mrb_p
(
mrb
,
mrb_obj_value
(
mrb
->
exc
));
}
else
{
mrb_print_error
(
mrb
);
}
n
=
-
1
;
...
...
mrbgems/mruby-compiler/core/codegen.c
View file @
b9f771dc
...
...
@@ -2993,6 +2993,7 @@ mrb_generate_code(mrb_state *mrb, parser_state *p)
{
codegen_scope
*
scope
=
scope_new
(
mrb
,
0
,
0
);
struct
RProc
*
proc
;
struct
mrb_jmpbuf
*
prev_jmp
=
mrb
->
jmp
;
if
(
!
scope
)
{
return
NULL
;
...
...
@@ -3003,17 +3004,20 @@ mrb_generate_code(mrb_state *mrb, parser_state *p)
scope
->
filename_index
=
p
->
current_filename_index
;
MRB_TRY
(
&
scope
->
jmp
)
{
mrb
->
jmp
=
&
scope
->
jmp
;
/* prepare irep */
codegen
(
scope
,
p
->
tree
,
NOVAL
);
proc
=
mrb_proc_new
(
mrb
,
scope
->
irep
);
mrb_irep_decref
(
mrb
,
scope
->
irep
);
mrb_pool_close
(
scope
->
mpool
);
proc
->
c
=
NULL
;
mrb
->
jmp
=
prev_jmp
;
return
proc
;
}
MRB_CATCH
(
&
scope
->
jmp
)
{
mrb_irep_decref
(
mrb
,
scope
->
irep
);
mrb_pool_close
(
scope
->
mpool
);
mrb
->
jmp
=
prev_jmp
;
return
NULL
;
}
MRB_END_EXC
(
&
scope
->
jmp
);
...
...
mrbgems/mruby-compiler/core/parse.y
View file @
b9f771dc
...
...
@@ -5579,7 +5579,6 @@ mrb_parser_parse(parser_state *p, mrbc_context *c)
}
MRB_CATCH(p->mrb->jmp) {
p->nerr++;
mrb_p(p->mrb, mrb_obj_value(p->mrb->exc));
}
MRB_END_EXC(p->mrb->jmp);
p->mrb->jmp = 0;
...
...
@@ -5789,7 +5788,9 @@ mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c)
return mrb_undef_value();
}
else {
mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SYNTAX_ERROR, "syntax error"));
if (mrb->exc == NULL) {
mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SYNTAX_ERROR, "syntax error"));
}
mrb_parser_free(p);
return mrb_undef_value();
}
...
...
@@ -5797,7 +5798,9 @@ mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c)
proc = mrb_generate_code(mrb, p);
mrb_parser_free(p);
if (proc == NULL) {
mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SCRIPT_ERROR, "codegen error"));
if (mrb->exc == NULL) {
mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SCRIPT_ERROR, "codegen error"));
}
return mrb_undef_value();
}
if (c) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment