X-Git-Url: https://git.llucax.com/software/druntime.git/blobdiff_plain/67b4d28f9c6426196dac4958874d1027e164468b..234ae5d9d62e8edcd9555c075cb5b1f404ef67a7:/src/compiler/dmd/object_.d 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; + } } /**