From f78d97c60047627164012fb10053c75ccf0ca7dd Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Mon, 26 Oct 2026 18:42:59 -0700 Subject: Child class call parents --- chapter28b/src/main/java/com/seaofnodes/simple/Parser.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/chapter28b/src/main/java/com/seaofnodes/simple/Parser.java b/chapter28b/src/main/java/com/seaofnodes/simple/Parser.java index 9df7fd18..b9cd9658 100644 --- a/chapter28b/src/main/java/com/seaofnodes/simple/Parser.java +++ b/chapter28b/src/main/java/com/seaofnodes/simple/Parser.java @@ -305,9 +305,18 @@ public class Parser { } } - // The initializer owns its run-once flag store. Parent initialization - // is a structural requirement, executed before this body by CLInit lowering. + // Each initializer establishes its parent before setting its own + // run-once flag. Keep this in the body so every execution strategy + // shares the same ordering, including direct entry into a child. if( fun.isClz() ) { + if( _ref._par!=null ) { + String pname = addClzPrefix(_ref._par._cname); + TypeStruct parent = (TypeStruct)TYPES.get(pname); + if( parent==null ) parent=TypeStruct.make(pname,true); + Node ptr = con(TypeMemPtr.make((byte)2,parent,true)).keep(); + classInit(loc,ptr); + ptr.unkeep(); + } Node self = fun.parm(2); Field flag = ((TypeMemPtr)self._type)._obj.field("$init"); Node prior = mem().keep(); -- cgit v1.2.3