summaryrefslogtreecommitdiff
path: root/method.h
diff options
context:
space:
mode:
Diffstat (limited to 'method.h')
-rw-r--r--method.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/method.h b/method.h
index 0185c059b5..e6d4fab8b3 100644
--- a/method.h
+++ b/method.h
@@ -49,12 +49,9 @@ typedef struct rb_method_cfunc_struct {
typedef struct rb_iseq_struct rb_iseq_t;
-typedef struct rb_method_entry_struct {
- rb_method_flag_t flag;
+typedef struct rb_method_definition_struct {
rb_method_type_t type; /* method type */
- ID called_id;
ID original_id;
- VALUE klass; /* should be mark */
union {
rb_iseq_t *iseq; /* should be mark */
rb_method_cfunc_t cfunc;
@@ -66,13 +63,23 @@ typedef struct rb_method_entry_struct {
} optimize_type;
} body;
int alias_count;
+} rb_method_definition_t;
+
+typedef struct rb_method_entry_struct {
+ rb_method_flag_t flag;
+ rb_method_definition_t *def;
+ ID called_id;
+ VALUE klass; /* should be mark */
} rb_method_entry_t;
+#define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
+
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex);
-void rb_add_method_me(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
+rb_method_entry_t *rb_add_method_me(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
int rb_method_entry_arity(const rb_method_entry_t *me);
void rb_gc_mark_method_entry(const rb_method_entry_t *me);
+void rb_free_method_entry(rb_method_entry_t *me);
#endif /* METHOD_H */