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
0cae5eaf
Commit
0cae5eaf
authored
May 17, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2791 from cremno/remove-mrb_define_method_vm
remove mrb_define_method_vm() function
parents
579ba2d9
2106d4d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
23 deletions
+4
-23
include/mruby/class.h
include/mruby/class.h
+0
-1
src/class.c
src/class.c
+2
-21
src/vm.c
src/vm.c
+2
-1
No files found.
include/mruby/class.h
View file @
0cae5eaf
...
...
@@ -55,7 +55,6 @@ MRB_API struct RClass* mrb_define_class_id(mrb_state*, mrb_sym, struct RClass*);
MRB_API
struct
RClass
*
mrb_define_module_id
(
mrb_state
*
,
mrb_sym
);
MRB_API
struct
RClass
*
mrb_vm_define_class
(
mrb_state
*
,
mrb_value
,
mrb_value
,
mrb_sym
);
MRB_API
struct
RClass
*
mrb_vm_define_module
(
mrb_state
*
,
mrb_value
,
mrb_sym
);
MRB_API
void
mrb_define_method_vm
(
mrb_state
*
,
struct
RClass
*
,
mrb_sym
,
mrb_value
);
MRB_API
void
mrb_define_method_raw
(
mrb_state
*
,
struct
RClass
*
,
mrb_sym
,
struct
RProc
*
);
MRB_API
void
mrb_define_method_id
(
mrb_state
*
mrb
,
struct
RClass
*
c
,
mrb_sym
mid
,
mrb_func_t
func
,
mrb_aspec
aspec
);
MRB_API
void
mrb_alias_method
(
mrb_state
*
mrb
,
struct
RClass
*
c
,
mrb_sym
a
,
mrb_sym
b
);
...
...
src/class.c
View file @
0cae5eaf
...
...
@@ -347,22 +347,6 @@ mrb_define_method(mrb_state *mrb, struct RClass *c, const char *name, mrb_func_t
mrb_define_method_id
(
mrb
,
c
,
mrb_intern_cstr
(
mrb
,
name
),
func
,
aspec
);
}
MRB_API
void
mrb_define_method_vm
(
mrb_state
*
mrb
,
struct
RClass
*
c
,
mrb_sym
name
,
mrb_value
body
)
{
khash_t
(
mt
)
*
h
=
c
->
mt
;
khiter_t
k
;
struct
RProc
*
p
;
if
(
!
h
)
h
=
c
->
mt
=
kh_init
(
mt
,
mrb
);
k
=
kh_put
(
mt
,
mrb
,
h
,
name
);
p
=
mrb_proc_ptr
(
body
);
kh_value
(
h
,
k
)
=
p
;
if
(
p
)
{
mrb_field_write_barrier
(
mrb
,
(
struct
RBasic
*
)
c
,
(
struct
RBasic
*
)
p
);
}
}
/* a function to raise NotImplementedError with current method name */
MRB_API
void
mrb_notimplement
(
mrb_state
*
mrb
)
...
...
@@ -1516,7 +1500,7 @@ mrb_alias_method(mrb_state *mrb, struct RClass *c, mrb_sym a, mrb_sym b)
{
struct
RProc
*
m
=
mrb_method_search
(
mrb
,
c
,
b
);
mrb_define_method_
vm
(
mrb
,
c
,
a
,
mrb_obj_value
(
m
)
);
mrb_define_method_
raw
(
mrb
,
c
,
a
,
m
);
}
/*!
...
...
@@ -1608,14 +1592,11 @@ mrb_mod_alias(mrb_state *mrb, mrb_value mod)
static
void
undef_method
(
mrb_state
*
mrb
,
struct
RClass
*
c
,
mrb_sym
a
)
{
mrb_value
m
;
if
(
!
mrb_obj_respond_to
(
mrb
,
c
,
a
))
{
mrb_name_error
(
mrb
,
a
,
"undefined method '%S' for class '%S'"
,
mrb_sym2str
(
mrb
,
a
),
mrb_obj_value
(
c
));
}
else
{
SET_PROC_VALUE
(
m
,
0
);
mrb_define_method_vm
(
mrb
,
c
,
a
,
m
);
mrb_define_method_raw
(
mrb
,
c
,
a
,
NULL
);
}
}
...
...
src/vm.c
View file @
0cae5eaf
...
...
@@ -2303,8 +2303,9 @@ RETRY_TRY_BLOCK:
/* A B R(A).newmethod(Syms(B),R(A+1)) */
int
a
=
GETARG_A
(
i
);
struct
RClass
*
c
=
mrb_class_ptr
(
regs
[
a
]);
struct
RProc
*
p
=
mrb_proc_ptr
(
regs
[
a
+
1
]);
mrb_define_method_
vm
(
mrb
,
c
,
syms
[
GETARG_B
(
i
)],
regs
[
a
+
1
]
);
mrb_define_method_
raw
(
mrb
,
c
,
syms
[
GETARG_B
(
i
)],
p
);
ARENA_RESTORE
(
mrb
,
ai
);
NEXT
;
}
...
...
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