X-Git-Url: https://git.llucax.com/software/druntime.git/blobdiff_plain/67b4d28f9c6426196dac4958874d1027e164468b..71bff88df52a4d1387776aa859df36879d787ecb:/src/compiler/dmd/object_.d?ds=sidebyside diff --git a/src/compiler/dmd/object_.d b/src/compiler/dmd/object_.d index ff69938..4e78220 100644 --- a/src/compiler/dmd/object_.d +++ b/src/compiler/dmd/object_.d @@ -125,6 +125,23 @@ class Object void lock(); void unlock(); } + + /****** + * Create instance of class specified by classname. + * The class must either have no constructors or have + * a default constructor. + * Returns: + * null if failed + */ + static Object factory(string classname) + { + auto ci = ClassInfo.find(classname); + if (ci) + { + return ci.create(); + } + return null; + } } /**