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
7dbfe19f
Commit
7dbfe19f
authored
May 10, 2014
by
ksss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OP_ENTER fix segmentation fault
parent
e07a3731
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
6 deletions
+32
-6
src/vm.c
src/vm.c
+9
-6
test/t/proc.rb
test/t/proc.rb
+23
-0
No files found.
src/vm.c
View file @
7dbfe19f
...
...
@@ -1306,16 +1306,19 @@ RETRY_TRY_BLOCK:
}
mrb
->
c
->
ci
->
argc
=
len
;
if
(
argc
<
len
)
{
int
mlen
=
m2
;
if
(
argc
<
m1
+
m2
)
{
if
(
m1
<
argc
)
mlen
=
argc
-
m1
;
else
mlen
=
0
;
}
regs
[
len
+
1
]
=
*
blk
;
/* move block */
SET_NIL_VALUE
(
regs
[
argc
+
1
]);
if
(
argv0
!=
argv
)
{
value_move
(
&
regs
[
1
],
argv
,
argc
-
m
2
);
/* m1 + o */
value_move
(
&
regs
[
1
],
argv
,
argc
-
m
len
);
/* m1 + o */
}
if
(
m2
)
{
int
mlen
=
m2
;
if
(
argc
-
m2
<=
m1
)
{
mlen
=
argc
-
m1
;
}
if
(
mlen
)
{
value_move
(
&
regs
[
len
-
m2
+
1
],
&
argv
[
argc
-
mlen
],
mlen
);
}
if
(
r
)
{
...
...
test/t/proc.rb
View file @
7dbfe19f
...
...
@@ -72,6 +72,29 @@ assert('Proc#call proc args pos block') do
assert_equal
[
1
,
2
,
Proc
,
:x
],
(
pr
.
call
(
1
,
2
,
3
,
4
){
|
x
|
x
})
end
assert
(
'Proc#call proc args pos rest post'
)
do
pr
=
Proc
.
new
{
|
a
,
b
,
*
c
,
d
,
e
|
[
a
,
b
,
c
,
d
,
e
]
}
assert_equal
[
nil
,
nil
,
[],
nil
,
nil
],
pr
.
call
()
assert_equal
[
1
,
nil
,
[],
nil
,
nil
],
pr
.
call
(
1
)
assert_equal
[
1
,
2
,
[],
nil
,
nil
],
pr
.
call
(
1
,
2
)
assert_equal
[
1
,
2
,
[],
3
,
nil
],
pr
.
call
(
1
,
2
,
3
)
assert_equal
[
1
,
2
,
[],
3
,
4
],
pr
.
call
(
1
,
2
,
3
,
4
)
assert_equal
[
1
,
2
,
[
3
],
4
,
5
],
pr
.
call
(
1
,
2
,
3
,
4
,
5
)
assert_equal
[
1
,
2
,
[
3
,
4
],
5
,
6
],
pr
.
call
(
1
,
2
,
3
,
4
,
5
,
6
)
assert_equal
[
1
,
2
,
[
3
,
4
,
5
],
6
,
7
],
pr
.
call
(
1
,
2
,
3
,
4
,
5
,
6
,
7
)
assert_equal
[
nil
,
nil
,
[],
nil
,
nil
],
pr
.
call
([])
assert_equal
[
1
,
nil
,
[],
nil
,
nil
],
pr
.
call
([
1
])
assert_equal
[
1
,
2
,
[],
nil
,
nil
],
pr
.
call
([
1
,
2
])
assert_equal
[
1
,
2
,
[],
3
,
nil
],
pr
.
call
([
1
,
2
,
3
])
assert_equal
[
1
,
2
,
[],
3
,
4
],
pr
.
call
([
1
,
2
,
3
,
4
])
assert_equal
[
1
,
2
,
[
3
],
4
,
5
],
pr
.
call
([
1
,
2
,
3
,
4
,
5
])
assert_equal
[
1
,
2
,
[
3
,
4
],
5
,
6
],
pr
.
call
([
1
,
2
,
3
,
4
,
5
,
6
])
assert_equal
[
1
,
2
,
[
3
,
4
,
5
],
6
,
7
],
pr
.
call
([
1
,
2
,
3
,
4
,
5
,
6
,
7
])
end
assert
(
'Proc#return_does_not_break_self'
)
do
class
TestClass
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