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
0bce3a36
Commit
0bce3a36
authored
Sep 18, 2013
by
Keita Obo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed self value in a block is changed with return value
fix #1504
parent
ccadbbeb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
src/codegen.c
src/codegen.c
+1
-2
test/t/proc.rb
test/t/proc.rb
+16
-0
No files found.
src/codegen.c
View file @
0bce3a36
...
...
@@ -286,8 +286,7 @@ genop_peep(codegen_scope *s, mrb_code i, int val)
case
OP_RANGE
:
case
OP_AREF
:
case
OP_GETUPVAR
:
s
->
iseq
[
s
->
pc
-
1
]
=
MKOP_ABC
(
c0
,
0
,
GETARG_B
(
i0
),
GETARG_C
(
i0
));
genop
(
s
,
MKOP_AB
(
OP_RETURN
,
0
,
OP_R_NORMAL
));
genop
(
s
,
MKOP_AB
(
OP_RETURN
,
GETARG_A
(
i0
),
OP_R_NORMAL
));
return
;
case
OP_SETIV
:
case
OP_SETCV
:
...
...
test/t/proc.rb
View file @
0bce3a36
...
...
@@ -54,3 +54,19 @@ assert('Proc#call', '15.2.17.4.3') do
assert_equal
1
,
a
assert_equal
5
,
a2
end
assert
(
'Proc#return_does_not_break_self'
)
do
class
TestClass
attr_accessor
:block
def
initialize
end
def
register_block
@block
=
Proc
.
new
{
self
}
return
[]
end
end
c
=
TestClass
.
new
assert_equal
[],
c
.
register_block
assert_equal
c
,
c
.
block
.
call
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