Closed leonardt closed 4 years ago
Yes, I had to muck around with various not so great solutions. I was thinking having class variables would be the way to go, but you can't define class variable that references the class (since it doesn't exist yet) so that was a dead end. The easy way would just be to call a factory method inside init, but that would be bad for performance since we'd have to do it every time an object is created, although cacheing could avoid some of this. I ended up with this which is essentially monkey patching (danger!!) after class definition (since you need a reference to the class to create the children), but at least we can wrap it cleanly inside the decorator pattern and avoids runtime cost by only having to do it at definition time.
Before, using a control structure such as
tester._if
would produce a StagedTester instance. This is problematic when using a SynchronousTester, since the produced tester doesn't inherit the expected methods (e.g. advance_cycle).Also fix unrelated magma error from missing
m.enable
cast (regression introduced in latest magma release)