mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
add function:check_const_name
This commit is contained in:
+13
@@ -7,6 +7,7 @@
|
||||
#include "mruby.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "mruby/class.h"
|
||||
#include "mruby/proc.h"
|
||||
#include "mruby/string.h"
|
||||
@@ -1442,6 +1443,18 @@ mrb_sym_value(mrb_state *mrb, mrb_value val)
|
||||
return mrb_symbol(val);
|
||||
}
|
||||
|
||||
static void
|
||||
check_const_name(mrb_state *mrb, mrb_sym id)
|
||||
{
|
||||
const char *s;
|
||||
int len;
|
||||
|
||||
s = mrb_sym2name_len(mrb, id, &len);
|
||||
if (len < 1 || !ISUPPER(*s)) {
|
||||
mrb_name_error(mrb, id, "wrong constant name %s", s);
|
||||
}
|
||||
}
|
||||
|
||||
mrb_value
|
||||
mrb_mod_const_defined(mrb_state *mrb, mrb_value mod)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user