static Runnable wrapAsActivity(O r) { if (r == null) null; Runnable r2 = toRunnable(r); ifdef LeanMode ret r2; endifdef ifndef LeanMode O mod = dm_current_generic(); if (mod == null) ret r2; ret r { AutoCloseable c = cast rcall enter(mod); temp c; r2.run(); }; endifndef }