diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-30 04:20:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-30 04:20:00 +0000 |
commit | 83cd51e3fe6e1e2be1375602274caa6ae0ac2a86 (patch) | |
tree | e2d59d7870dbc9b8e83c5af528bbaa709df41cc4 /constant.h | |
parent | c3f6e4ea078af93e79d578bf312a9a26af82f09b (diff) | |
download | ruby-83cd51e3fe6e1e2be1375602274caa6ae0ac2a86.tar.gz |
variable.c: Module#deprecate_constant
* variable.c (rb_const_get_0): warn deprecated constant reference.
* variable.c (rb_mod_deprecate_constant): mark constants to be
warned as deprecated. [Feature #11398]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'constant.h')
-rw-r--r-- | constant.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/constant.h b/constant.h index c7de5da533..23d17ac24c 100644 --- a/constant.h +++ b/constant.h @@ -12,15 +12,21 @@ #define CONSTANT_H typedef enum { + CONST_DEPRECATED = 0x100, + + CONST_VISIBILITY_MASK = 0xff, CONST_PUBLIC = 0x00, CONST_PRIVATE, CONST_VISIBILITY_MAX } rb_const_flag_t; #define RB_CONST_PRIVATE_P(ce) \ - ((ce)->flag == CONST_PRIVATE) + (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PRIVATE) #define RB_CONST_PUBLIC_P(ce) \ - ((ce)->flag == CONST_PUBLIC) + (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PUBLIC) + +#define RB_CONST_DEPRECATED_P(ce) \ + ((ce)->flag & CONST_DEPRECATED) typedef struct rb_const_entry_struct { rb_const_flag_t flag; @@ -31,6 +37,7 @@ typedef struct rb_const_entry_struct { VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj); VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj); +VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj); void rb_free_const_table(st_table *tbl); VALUE rb_public_const_get(VALUE klass, ID id); VALUE rb_public_const_get_at(VALUE klass, ID id); |