mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #1224 from h2so5/remove-mrb_class_obj_get
Remove mrb_class_obj_get
This commit is contained in:
+14
-15
@@ -161,7 +161,6 @@ struct RClass * mrb_class_new(mrb_state *mrb, struct RClass *super);
|
||||
struct RClass * mrb_module_new(mrb_state *mrb);
|
||||
int mrb_class_defined(mrb_state *mrb, const char *name);
|
||||
struct RClass * mrb_class_get(mrb_state *mrb, const char *name);
|
||||
struct RClass * mrb_class_obj_get(mrb_state *mrb, const char *name);
|
||||
|
||||
mrb_value mrb_obj_dup(mrb_state *mrb, mrb_value obj);
|
||||
mrb_value mrb_check_to_integer(mrb_state *mrb, mrb_value val, const char *method);
|
||||
@@ -308,22 +307,22 @@ void mrb_bug(const char *fmt, ...);
|
||||
+ those E_* macros requires mrb_state* variable named mrb.
|
||||
+ exception objects obtained from those macros are local to mrb
|
||||
*/
|
||||
#define E_RUNTIME_ERROR (mrb_class_obj_get(mrb, "RuntimeError"))
|
||||
#define E_TYPE_ERROR (mrb_class_obj_get(mrb, "TypeError"))
|
||||
#define E_ARGUMENT_ERROR (mrb_class_obj_get(mrb, "ArgumentError"))
|
||||
#define E_INDEX_ERROR (mrb_class_obj_get(mrb, "IndexError"))
|
||||
#define E_RANGE_ERROR (mrb_class_obj_get(mrb, "RangeError"))
|
||||
#define E_NAME_ERROR (mrb_class_obj_get(mrb, "NameError"))
|
||||
#define E_NOMETHOD_ERROR (mrb_class_obj_get(mrb, "NoMethodError"))
|
||||
#define E_SCRIPT_ERROR (mrb_class_obj_get(mrb, "ScriptError"))
|
||||
#define E_SYNTAX_ERROR (mrb_class_obj_get(mrb, "SyntaxError"))
|
||||
#define E_LOCALJUMP_ERROR (mrb_class_obj_get(mrb, "LocalJumpError"))
|
||||
#define E_REGEXP_ERROR (mrb_class_obj_get(mrb, "RegexpError"))
|
||||
#define E_RUNTIME_ERROR (mrb_class_get(mrb, "RuntimeError"))
|
||||
#define E_TYPE_ERROR (mrb_class_get(mrb, "TypeError"))
|
||||
#define E_ARGUMENT_ERROR (mrb_class_get(mrb, "ArgumentError"))
|
||||
#define E_INDEX_ERROR (mrb_class_get(mrb, "IndexError"))
|
||||
#define E_RANGE_ERROR (mrb_class_get(mrb, "RangeError"))
|
||||
#define E_NAME_ERROR (mrb_class_get(mrb, "NameError"))
|
||||
#define E_NOMETHOD_ERROR (mrb_class_get(mrb, "NoMethodError"))
|
||||
#define E_SCRIPT_ERROR (mrb_class_get(mrb, "ScriptError"))
|
||||
#define E_SYNTAX_ERROR (mrb_class_get(mrb, "SyntaxError"))
|
||||
#define E_LOCALJUMP_ERROR (mrb_class_get(mrb, "LocalJumpError"))
|
||||
#define E_REGEXP_ERROR (mrb_class_get(mrb, "RegexpError"))
|
||||
|
||||
#define E_NOTIMP_ERROR (mrb_class_obj_get(mrb, "NotImplementedError"))
|
||||
#define E_FLOATDOMAIN_ERROR (mrb_class_obj_get(mrb, "FloatDomainError"))
|
||||
#define E_NOTIMP_ERROR (mrb_class_get(mrb, "NotImplementedError"))
|
||||
#define E_FLOATDOMAIN_ERROR (mrb_class_get(mrb, "FloatDomainError"))
|
||||
|
||||
#define E_KEY_ERROR (mrb_class_obj_get(mrb, "KeyError"))
|
||||
#define E_KEY_ERROR (mrb_class_get(mrb, "KeyError"))
|
||||
|
||||
mrb_value mrb_yield(mrb_state *mrb, mrb_value v, mrb_value blk);
|
||||
mrb_value mrb_yield_argv(mrb_state *mrb, mrb_value b, int argc, mrb_value *argv);
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
#include "mruby/range.h"
|
||||
#include "mruby/string.h"
|
||||
|
||||
#define RANGE_CLASS (mrb_class_obj_get(mrb, "Range"))
|
||||
#define RANGE_CLASS (mrb_class_get(mrb, "Range"))
|
||||
|
||||
static void
|
||||
range_check(mrb_state *mrb, mrb_value a, mrb_value b)
|
||||
|
||||
@@ -1066,15 +1066,6 @@ mrb_attr_get(mrb_state *mrb, mrb_value obj, mrb_sym id)
|
||||
return mrb_iv_get(mrb, obj, id);
|
||||
}
|
||||
|
||||
struct RClass *
|
||||
mrb_class_obj_get(mrb_state *mrb, const char *name)
|
||||
{
|
||||
mrb_value mod = mrb_obj_value(mrb->object_class);
|
||||
mrb_sym sym = mrb_intern(mrb, name);
|
||||
|
||||
return mrb_class_ptr(mrb_const_get(mrb, mod, sym));
|
||||
}
|
||||
|
||||
struct csym_arg {
|
||||
struct RClass *c;
|
||||
mrb_sym sym;
|
||||
|
||||
Reference in New Issue
Block a user