deprecate Object.factory

This commit is contained in:
Walter Bright 2022-12-09 19:40:53 -08:00 committed by The Dlang Bot
parent c8ae4adb2e
commit 5600cfb42f
4 changed files with 6 additions and 4 deletions

View file

@ -1,3 +1,5 @@
// REQUIRED_ARGS: -d
module test34; module test34;
import core.exception; import core.exception;

View file

@ -1,4 +1,4 @@
// REQUIRED_ARGS: -preview=rvaluerefparam // REQUIRED_ARGS: -d -preview=rvaluerefparam
// //
/* TEST_OUTPUT: /* TEST_OUTPUT:
--- ---

View file

@ -1,5 +1,5 @@
/* /*
REQUIRED_ARGS: -lowmem -Jrunnable -preview=rvaluerefparam REQUIRED_ARGS: -d -lowmem -Jrunnable -preview=rvaluerefparam
EXTRA_FILES: xtest46.d EXTRA_FILES: xtest46.d
TEST_OUTPUT: TEST_OUTPUT:
--- ---

View file

@ -246,7 +246,7 @@ class Object
* } * }
* --- * ---
*/ */
static Object factory(string classname) deprecated static Object factory(string classname)
{ {
auto ci = TypeInfo_Class.find(classname); auto ci = TypeInfo_Class.find(classname);
if (ci) if (ci)
@ -256,7 +256,7 @@ class Object
return null; return null;
} }
@system unittest deprecated @system unittest
{ {
Object valid_obj = Object.factory("object.Object"); Object valid_obj = Object.factory("object.Object");
Object invalid_obj = Object.factory("object.__this_class_doesnt_exist__"); Object invalid_obj = Object.factory("object.__this_class_doesnt_exist__");