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
089f1f6c
Commit
089f1f6c
authored
Jan 31, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
block_given? should work with nested block; fix #2695 close #2712
parent
02b54e53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
src/kernel.c
src/kernel.c
+15
-8
No files found.
src/kernel.c
View file @
089f1f6c
...
...
@@ -186,14 +186,21 @@ mrb_f_block_given_p_m(mrb_state *mrb, mrb_value self)
}
else
{
/* block_given? called within block; check upper scope */
if
(
ci
->
proc
->
env
&&
ci
->
proc
->
env
->
stack
)
{
mrb_value
*
sp
=
ci
->
proc
->
env
->
stack
;
/* top-level does not have block slot (alway false) */
if
(
sp
==
mrb
->
c
->
stbase
)
return
mrb_false_value
();
ci
=
mrb
->
c
->
cibase
+
ci
->
proc
->
env
->
cioff
;
bp
=
ci
[
1
].
stackent
+
1
;
if
(
ci
->
proc
->
env
)
{
struct
REnv
*
e
=
ci
->
proc
->
env
;
mrb_value
*
sp
;
while
(
e
->
c
)
{
e
=
(
struct
REnv
*
)
e
->
c
;
}
sp
=
e
->
stack
;
if
(
sp
)
{
/* top-level does not have block slot (alway false) */
if
(
sp
==
mrb
->
c
->
stbase
)
return
mrb_false_value
();
ci
=
mrb
->
c
->
cibase
+
e
->
cioff
;
bp
=
ci
[
1
].
stackent
+
1
;
}
}
if
(
ci
->
argc
>
0
)
{
bp
+=
ci
->
argc
;
...
...
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