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
abe6db94
Commit
abe6db94
authored
Oct 30, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
resolve conflict #1552
parents
ad4ce2ba
12e00f92
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/class.c
src/class.c
+9
-6
test/t/class.rb
test/t/class.rb
+9
-1
No files found.
src/class.c
View file @
abe6db94
...
@@ -1080,15 +1080,18 @@ mrb_obj_new(mrb_state *mrb, struct RClass *c, int argc, mrb_value *argv)
...
@@ -1080,15 +1080,18 @@ mrb_obj_new(mrb_state *mrb, struct RClass *c, int argc, mrb_value *argv)
static
mrb_value
static
mrb_value
mrb_class_new_class
(
mrb_state
*
mrb
,
mrb_value
cv
)
mrb_class_new_class
(
mrb_state
*
mrb
,
mrb_value
cv
)
{
{
mrb_value
super
;
mrb_value
super
,
blk
;
struct
RClass
*
new_class
;
mrb_value
new_class
;
if
(
mrb_get_args
(
mrb
,
"|C
"
,
&
super
)
==
0
)
{
if
(
mrb_get_args
(
mrb
,
"|C
&"
,
&
super
,
&
blk
)
==
0
)
{
super
=
mrb_obj_value
(
mrb
->
object_class
);
super
=
mrb_obj_value
(
mrb
->
object_class
);
}
}
new_class
=
mrb_class_new
(
mrb
,
mrb_class_ptr
(
super
));
new_class
=
mrb_obj_value
(
mrb_class_new
(
mrb
,
mrb_class_ptr
(
super
)));
mrb_funcall
(
mrb
,
super
,
"inherited"
,
1
,
mrb_obj_value
(
new_class
));
if
(
!
mrb_nil_p
(
blk
))
{
return
mrb_obj_value
(
new_class
);
mrb_funcall_with_block
(
mrb
,
new_class
,
mrb_intern_cstr
(
mrb
,
"class_eval"
),
0
,
NULL
,
blk
);
}
mrb_funcall
(
mrb
,
super
,
"inherited"
,
1
,
new_class
);
return
new_class
;
}
}
mrb_value
mrb_value
...
...
test/t/class.rb
View file @
abe6db94
...
@@ -9,7 +9,15 @@ assert('Class superclass', '15.2.3.2') do
...
@@ -9,7 +9,15 @@ assert('Class superclass', '15.2.3.2') do
assert_equal
(
Module
,
Class
.
superclass
)
assert_equal
(
Module
,
Class
.
superclass
)
end
end
# Class#initialize '15.2.3.3.1' is tested in Class#new
assert
(
'Class#initialize'
,
'15.2.3.3.1'
)
do
c
=
Class
.
new
do
def
test
:test
end
end
.
new
assert_equal
(
c
.
test
,
:test
)
end
assert
(
'Class#initialize_copy'
,
'15.2.3.3.2'
)
do
assert
(
'Class#initialize_copy'
,
'15.2.3.3.2'
)
do
class
TestClass
class
TestClass
...
...
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