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
6a1978c7
Commit
6a1978c7
authored
May 31, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix OP_APOST bug for no pre arg cases; fix #2810
parent
9ef4bbb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
21 deletions
+16
-21
src/vm.c
src/vm.c
+16
-21
No files found.
src/vm.c
View file @
6a1978c7
...
...
@@ -2125,33 +2125,28 @@ RETRY_TRY_BLOCK:
int
pre
=
GETARG_B
(
i
);
int
post
=
GETARG_C
(
i
);
struct
RArray
*
ary
;
int
len
,
idx
;
if
(
!
mrb_array_p
(
v
))
{
regs
[
a
++
]
=
mrb_ary_new_capa
(
mrb
,
0
);
v
=
mrb_ary_new_from_values
(
mrb
,
1
,
&
regs
[
a
]);
}
ary
=
mrb_ary_ptr
(
v
);
len
=
ary
->
len
;
if
(
len
>
pre
+
post
)
{
regs
[
a
++
]
=
mrb_ary_new_from_values
(
mrb
,
len
-
pre
-
post
,
ary
->
ptr
+
pre
);
while
(
post
--
)
{
SET_NIL_VALUE
(
regs
[
a
]);
a
++
;
regs
[
a
++
]
=
ary
->
ptr
[
len
-
post
-
1
];
}
}
else
{
struct
RArray
*
ary
=
mrb_ary_ptr
(
v
);
int
len
=
ary
->
len
;
int
idx
;
if
(
len
>
pre
+
post
)
{
regs
[
a
++
]
=
mrb_ary_new_from_values
(
mrb
,
len
-
pre
-
post
,
ary
->
ptr
+
pre
);
while
(
post
--
)
{
regs
[
a
++
]
=
ary
->
ptr
[
len
-
post
-
1
];
}
regs
[
a
++
]
=
mrb_ary_new_capa
(
mrb
,
0
);
for
(
idx
=
0
;
idx
+
pre
<
len
;
idx
++
)
{
regs
[
a
+
idx
]
=
ary
->
ptr
[
pre
+
idx
];
}
else
{
regs
[
a
++
]
=
mrb_ary_new_capa
(
mrb
,
0
);
for
(
idx
=
0
;
idx
+
pre
<
len
;
idx
++
)
{
regs
[
a
+
idx
]
=
ary
->
ptr
[
pre
+
idx
];
}
while
(
idx
<
post
)
{
SET_NIL_VALUE
(
regs
[
a
+
idx
]);
idx
++
;
}
while
(
idx
<
post
)
{
SET_NIL_VALUE
(
regs
[
a
+
idx
]);
idx
++
;
}
}
ARENA_RESTORE
(
mrb
,
ai
);
...
...
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