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
0629cf21
Commit
0629cf21
authored
Jun 03, 2012
by
Kazuki Tsujimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A rescue clause with no parameter list rescues only StandardErrors
parent
597978c1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
16 deletions
+58
-16
src/codegen.c
src/codegen.c
+22
-16
test/t/exception.rb
test/t/exception.rb
+36
-0
No files found.
src/codegen.c
View file @
0629cf21
...
...
@@ -834,14 +834,18 @@ codegen(codegen_scope *s, node *tree, int val)
push
();
while
(
n2
)
{
node
*
n3
=
n2
->
car
;
if
(
pos1
)
dispatch
(
s
,
pos1
);
if
(
n3
->
car
)
{
node
*
n4
=
n3
->
car
;
if
(
pos1
)
dispatch
(
s
,
pos1
);
pos2
=
0
;
while
(
n4
)
{
do
{
if
(
n4
)
{
codegen
(
s
,
n4
->
car
,
VAL
);
}
else
{
genop
(
s
,
MKOP_ABx
(
OP_GETCONST
,
cursp
(),
new_msym
(
s
,
mrb_intern
(
s
->
mrb
,
"StandardError"
))));
push
();
}
genop
(
s
,
MKOP_AB
(
OP_MOVE
,
cursp
(),
exc
));
push
();
genop
(
s
,
MKOP_A
(
OP_LOADNIL
,
cursp
()));
...
...
@@ -850,12 +854,14 @@ codegen(codegen_scope *s, node *tree, int val)
tmp
=
new_label
(
s
);
genop
(
s
,
MKOP_AsBx
(
OP_JMPIF
,
cursp
(),
pos2
));
pos2
=
tmp
;
if
(
n4
)
{
n4
=
n4
->
cdr
;
}
}
while
(
n4
);
pos1
=
new_label
(
s
);
genop
(
s
,
MKOP_Bx
(
OP_JMP
,
0
));
dispatch_linked
(
s
,
pos2
);
}
pop
();
if
(
n3
->
cdr
->
car
)
{
gen_assignment
(
s
,
n3
->
cdr
->
car
,
exc
,
NOVAL
);
...
...
test/t/exception.rb
View file @
0629cf21
...
...
@@ -193,3 +193,39 @@ assert('Exception 10') do
7
+
7
end
==
12
end
assert
(
'Exception 11'
)
do
a
=
:ok
begin
begin
raise
Exception
rescue
a
=
:ng
end
rescue
Exception
end
a
==
:ok
end
assert
(
'Exception 12'
)
do
a
=
:ok
begin
raise
Exception
rescue
a
=
:ng
rescue
Exception
end
a
==
:ok
end
assert
(
'Exception 13'
)
do
a
=
:ng
begin
raise
StandardError
rescue
TypeError
,
ArgumentError
a
=
:ng
rescue
a
=
:ok
else
a
=
:ng
end
a
==
:ok
end
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