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
7fe34d8f
Commit
7fe34d8f
authored
May 23, 2014
by
ksss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Should not call inherited method
when class nothing
parent
5900bb37
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
src/class.c
src/class.c
+12
-2
No files found.
src/class.c
View file @
7fe34d8f
...
...
@@ -210,6 +210,14 @@ mrb_define_class(mrb_state *mrb, const char *name, struct RClass *super)
return
mrb_define_class_id
(
mrb
,
mrb_intern_cstr
(
mrb
,
name
),
super
);
}
static
void
mrb_class_inherited
(
mrb_state
*
mrb
,
struct
RClass
*
super
,
struct
RClass
*
klass
)
{
if
(
!
super
)
super
=
mrb
->
object_class
;
mrb_funcall
(
mrb
,
mrb_obj_value
(
super
),
"inherited"
,
1
,
mrb_obj_value
(
klass
));
}
struct
RClass
*
mrb_vm_define_class
(
mrb_state
*
mrb
,
mrb_value
outer
,
mrb_value
super
,
mrb_sym
id
)
{
...
...
@@ -235,7 +243,7 @@ mrb_vm_define_class(mrb_state *mrb, mrb_value outer, mrb_value super, mrb_sym id
break
;
}
c
=
define_class
(
mrb
,
id
,
s
,
mrb_class_ptr
(
outer
));
mrb_
funcall
(
mrb
,
mrb_obj_value
(
mrb_class_real
(
c
->
super
)),
"inherited"
,
1
,
mrb_obj_value
(
c
)
);
mrb_
class_inherited
(
mrb
,
mrb_class_real
(
c
->
super
),
c
);
return
c
;
}
...
...
@@ -1119,7 +1127,7 @@ mrb_class_new_class(mrb_state *mrb, mrb_value cv)
}
new_class
=
mrb_obj_value
(
mrb_class_new
(
mrb
,
mrb_class_ptr
(
super
)));
mrb_funcall_with_block
(
mrb
,
new_class
,
mrb_intern_lit
(
mrb
,
"initialize"
),
n
,
&
super
,
blk
);
mrb_
funcall
(
mrb
,
super
,
"inherited"
,
1
,
new_class
);
mrb_
class_inherited
(
mrb
,
mrb_class_ptr
(
super
),
mrb_class_ptr
(
new_class
)
);
return
new_class
;
}
...
...
@@ -1287,6 +1295,8 @@ mrb_class_path(mrb_state *mrb, struct RClass *c)
struct
RClass
*
mrb_class_real
(
struct
RClass
*
cl
)
{
if
(
cl
==
0
)
return
0
;
while
((
cl
->
tt
==
MRB_TT_SCLASS
)
||
(
cl
->
tt
==
MRB_TT_ICLASS
))
{
cl
=
cl
->
super
;
}
...
...
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