зеркало из https://github.com/github/ruby.git
Data: delete
Has been deprecated since 684bdf6171
.
Matz says in [ruby-core:83954] that Data should be an alias of Object.
Because rb_cData has not been deprecated, let us deprecate the constant
to make it a C-level synonym of rb_cObject.
This commit is contained in:
Родитель
5c0abe2d94
Коммит
c30f03d328
2
error.c
2
error.c
|
@ -2786,7 +2786,7 @@ Init_Exception(void)
|
||||||
rb_define_method(rb_eNameError, "name", name_err_name, 0);
|
rb_define_method(rb_eNameError, "name", name_err_name, 0);
|
||||||
rb_define_method(rb_eNameError, "receiver", name_err_receiver, 0);
|
rb_define_method(rb_eNameError, "receiver", name_err_receiver, 0);
|
||||||
rb_define_method(rb_eNameError, "local_variables", name_err_local_variables, 0);
|
rb_define_method(rb_eNameError, "local_variables", name_err_local_variables, 0);
|
||||||
rb_cNameErrorMesg = rb_define_class_under(rb_eNameError, "message", rb_cData);
|
rb_cNameErrorMesg = rb_define_class_under(rb_eNameError, "message", rb_cObject);
|
||||||
rb_define_method(rb_cNameErrorMesg, "==", name_err_mesg_equal, 1);
|
rb_define_method(rb_cNameErrorMesg, "==", name_err_mesg_equal, 1);
|
||||||
rb_define_method(rb_cNameErrorMesg, "to_str", name_err_mesg_to_str, 0);
|
rb_define_method(rb_cNameErrorMesg, "to_str", name_err_mesg_to_str, 0);
|
||||||
rb_define_method(rb_cNameErrorMesg, "_dump", name_err_mesg_dump, 1);
|
rb_define_method(rb_cNameErrorMesg, "_dump", name_err_mesg_dump, 1);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
* extension libraries. They could be written in C++98.
|
* extension libraries. They could be written in C++98.
|
||||||
* @brief Ruby-level global variables / constants, visible from C.
|
* @brief Ruby-level global variables / constants, visible from C.
|
||||||
*/
|
*/
|
||||||
|
#include "ruby/internal/attr/deprecated.h"
|
||||||
#include "ruby/internal/attr/pure.h"
|
#include "ruby/internal/attr/pure.h"
|
||||||
#include "ruby/internal/dllexport.h"
|
#include "ruby/internal/dllexport.h"
|
||||||
#include "ruby/internal/fl_type.h"
|
#include "ruby/internal/fl_type.h"
|
||||||
|
@ -48,6 +49,7 @@ RUBY_EXTERN VALUE rb_cArray;
|
||||||
RUBY_EXTERN VALUE rb_cBinding;
|
RUBY_EXTERN VALUE rb_cBinding;
|
||||||
RUBY_EXTERN VALUE rb_cClass;
|
RUBY_EXTERN VALUE rb_cClass;
|
||||||
RUBY_EXTERN VALUE rb_cCont;
|
RUBY_EXTERN VALUE rb_cCont;
|
||||||
|
RBIMPL_ATTR_DEPRECATED(("by: rb_cObject. Will be removed in 3.1."))
|
||||||
RUBY_EXTERN VALUE rb_cData;
|
RUBY_EXTERN VALUE rb_cData;
|
||||||
RUBY_EXTERN VALUE rb_cDir;
|
RUBY_EXTERN VALUE rb_cDir;
|
||||||
RUBY_EXTERN VALUE rb_cEncoding;
|
RUBY_EXTERN VALUE rb_cEncoding;
|
||||||
|
|
30
object.c
30
object.c
|
@ -32,6 +32,7 @@
|
||||||
#include "internal/struct.h"
|
#include "internal/struct.h"
|
||||||
#include "internal/symbol.h"
|
#include "internal/symbol.h"
|
||||||
#include "internal/variable.h"
|
#include "internal/variable.h"
|
||||||
|
#include "internal/warnings.h"
|
||||||
#include "probes.h"
|
#include "probes.h"
|
||||||
#include "ruby/encoding.h"
|
#include "ruby/encoding.h"
|
||||||
#include "ruby/st.h"
|
#include "ruby/st.h"
|
||||||
|
@ -4330,6 +4331,25 @@ f_sprintf(int c, const VALUE *v, VALUE _)
|
||||||
return rb_f_sprintf(c, v);
|
return rb_f_sprintf(c, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COMPILER_WARNING_PUSH
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
COMPILER_WARNING_IGNORED(4996)
|
||||||
|
#elif defined(__INTEL_COMPILER)
|
||||||
|
COMPILER_WARNING_IGNORED(1786)
|
||||||
|
#elif __has_warning("-Wdeprecated-declarations")
|
||||||
|
COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
Init_rb_cData(void)
|
||||||
|
{
|
||||||
|
rb_cData = rb_cObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
COMPILER_WARNING_POP
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Document-class: Class
|
* Document-class: Class
|
||||||
*
|
*
|
||||||
|
@ -4662,15 +4682,7 @@ InitVM_Object(void)
|
||||||
rb_undef_method(rb_cClass, "append_features");
|
rb_undef_method(rb_cClass, "append_features");
|
||||||
rb_undef_method(rb_cClass, "prepend_features");
|
rb_undef_method(rb_cClass, "prepend_features");
|
||||||
|
|
||||||
/*
|
Init_rb_cData();
|
||||||
* Document-class: Data
|
|
||||||
*
|
|
||||||
* This is a deprecated class, base class for C extensions using
|
|
||||||
* Data_Make_Struct or Data_Wrap_Struct.
|
|
||||||
*/
|
|
||||||
rb_cData = rb_define_class("Data", rb_cObject);
|
|
||||||
rb_undef_alloc_func(rb_cData);
|
|
||||||
rb_deprecate_constant(rb_cObject, "Data");
|
|
||||||
|
|
||||||
rb_cTrueClass = rb_define_class("TrueClass", rb_cObject);
|
rb_cTrueClass = rb_define_class("TrueClass", rb_cObject);
|
||||||
rb_cTrueClass_to_s = rb_fstring_enc_lit("true", rb_usascii_encoding());
|
rb_cTrueClass_to_s = rb_fstring_enc_lit("true", rb_usascii_encoding());
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
require_relative '../../spec_helper'
|
require_relative '../../spec_helper'
|
||||||
|
|
||||||
|
ruby_version_is ''...'2.8' do
|
||||||
describe "Data" do
|
describe "Data" do
|
||||||
it "is a subclass of Object" do
|
it "is a subclass of Object" do
|
||||||
suppress_warning do
|
suppress_warning do
|
||||||
|
@ -11,3 +12,4 @@ describe "Data" do
|
||||||
-> { Data }.should complain(/constant ::Data is deprecated/)
|
-> { Data }.should complain(/constant ::Data is deprecated/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -4462,7 +4462,7 @@ InitVM_transcode(void)
|
||||||
rb_define_method(rb_cString, "encode", str_encode, -1);
|
rb_define_method(rb_cString, "encode", str_encode, -1);
|
||||||
rb_define_method(rb_cString, "encode!", str_encode_bang, -1);
|
rb_define_method(rb_cString, "encode!", str_encode_bang, -1);
|
||||||
|
|
||||||
rb_cEncodingConverter = rb_define_class_under(rb_cEncoding, "Converter", rb_cData);
|
rb_cEncodingConverter = rb_define_class_under(rb_cEncoding, "Converter", rb_cObject);
|
||||||
rb_define_alloc_func(rb_cEncodingConverter, econv_s_allocate);
|
rb_define_alloc_func(rb_cEncodingConverter, econv_s_allocate);
|
||||||
rb_define_singleton_method(rb_cEncodingConverter, "asciicompat_encoding", econv_s_asciicompat_encoding, 1);
|
rb_define_singleton_method(rb_cEncodingConverter, "asciicompat_encoding", econv_s_asciicompat_encoding, 1);
|
||||||
rb_define_singleton_method(rb_cEncodingConverter, "search_convpath", econv_s_search_convpath, -1);
|
rb_define_singleton_method(rb_cEncodingConverter, "search_convpath", econv_s_search_convpath, -1);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче