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
f408143c
Commit
f408143c
authored
Jun 01, 2018
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The `clone` method should copy object status (e.g. frozen) too; #4030
parent
7ed164ba
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
src/kernel.c
src/kernel.c
+1
-0
test/t/kernel.rb
test/t/kernel.rb
+4
-0
No files found.
src/kernel.c
View file @
f408143c
...
@@ -348,6 +348,7 @@ mrb_obj_clone(mrb_state *mrb, mrb_value self)
...
@@ -348,6 +348,7 @@ mrb_obj_clone(mrb_state *mrb, mrb_value self)
mrb_field_write_barrier
(
mrb
,
(
struct
RBasic
*
)
p
,
(
struct
RBasic
*
)
p
->
c
);
mrb_field_write_barrier
(
mrb
,
(
struct
RBasic
*
)
p
,
(
struct
RBasic
*
)
p
->
c
);
clone
=
mrb_obj_value
(
p
);
clone
=
mrb_obj_value
(
p
);
init_copy
(
mrb
,
clone
,
self
);
init_copy
(
mrb
,
clone
,
self
);
p
->
flags
=
mrb_obj_ptr
(
self
)
->
flags
;
return
clone
;
return
clone
;
}
}
...
...
test/t/kernel.rb
View file @
f408143c
...
@@ -171,6 +171,10 @@ assert('Kernel#clone', '15.3.1.3.8') do
...
@@ -171,6 +171,10 @@ assert('Kernel#clone', '15.3.1.3.8') do
assert_true
a
.
respond_to?
(
:test
)
assert_true
a
.
respond_to?
(
:test
)
assert_false
b
.
respond_to?
(
:test
)
assert_false
b
.
respond_to?
(
:test
)
assert_true
c
.
respond_to?
(
:test
)
assert_true
c
.
respond_to?
(
:test
)
a
.
freeze
d
=
a
.
clone
assert_true
d
.
frozen?
end
end
assert
(
'Kernel#dup'
,
'15.3.1.3.9'
)
do
assert
(
'Kernel#dup'
,
'15.3.1.3.9'
)
do
...
...
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