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
06a67df9
Commit
06a67df9
authored
May 09, 2014
by
ksss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OP_ENTER clean block object in register
parent
c071ad13
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
src/vm.c
src/vm.c
+1
-0
test/t/proc.rb
test/t/proc.rb
+17
-0
No files found.
src/vm.c
View file @
06a67df9
...
@@ -1307,6 +1307,7 @@ RETRY_TRY_BLOCK:
...
@@ -1307,6 +1307,7 @@ RETRY_TRY_BLOCK:
mrb
->
c
->
ci
->
argc
=
len
;
mrb
->
c
->
ci
->
argc
=
len
;
if
(
argc
<
len
)
{
if
(
argc
<
len
)
{
regs
[
len
+
1
]
=
*
blk
;
/* move block */
regs
[
len
+
1
]
=
*
blk
;
/* move block */
SET_NIL_VALUE
(
regs
[
argc
+
1
]);
if
(
argv0
!=
argv
)
{
if
(
argv0
!=
argv
)
{
value_move
(
&
regs
[
1
],
argv
,
argc
-
m2
);
/* m1 + o */
value_move
(
&
regs
[
1
],
argv
,
argc
-
m2
);
/* m1 + o */
}
}
...
...
test/t/proc.rb
View file @
06a67df9
...
@@ -55,6 +55,23 @@ assert('Proc#call', '15.2.17.4.3') do
...
@@ -55,6 +55,23 @@ assert('Proc#call', '15.2.17.4.3') do
assert_equal
5
,
a2
assert_equal
5
,
a2
end
end
assert
(
'Proc#call proc args pos block'
)
do
pr
=
proc
{
|
a
,
b
,
&
c
|
[
a
,
b
,
c
.
class
,
c
&&
c
.
call
(
:x
)]
}
assert_equal
[
nil
,
nil
,
Proc
,
:proc
],
(
pr
.
call
(){
:proc
})
assert_equal
[
1
,
nil
,
Proc
,
:proc
],
(
pr
.
call
(
1
){
:proc
})
assert_equal
[
1
,
2
,
Proc
,
:proc
],
(
pr
.
call
(
1
,
2
){
:proc
})
assert_equal
[
1
,
2
,
Proc
,
:proc
],
(
pr
.
call
(
1
,
2
,
3
){
:proc
})
assert_equal
[
1
,
2
,
Proc
,
:proc
],
(
pr
.
call
(
1
,
2
,
3
,
4
){
:proc
})
assert_equal
[
nil
,
nil
,
Proc
,
:x
],
(
pr
.
call
(){
|
x
|
x
})
assert_equal
[
1
,
nil
,
Proc
,
:x
],
(
pr
.
call
(
1
){
|
x
|
x
})
assert_equal
[
1
,
2
,
Proc
,
:x
],
(
pr
.
call
(
1
,
2
){
|
x
|
x
})
assert_equal
[
1
,
2
,
Proc
,
:x
],
(
pr
.
call
(
1
,
2
,
3
){
|
x
|
x
})
assert_equal
[
1
,
2
,
Proc
,
:x
],
(
pr
.
call
(
1
,
2
,
3
,
4
){
|
x
|
x
})
end
assert
(
'Proc#return_does_not_break_self'
)
do
assert
(
'Proc#return_does_not_break_self'
)
do
class
TestClass
class
TestClass
attr_accessor
:block
attr_accessor
:block
...
...
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