From 8ab80ff8bcd220783054b9c0d6925516fc8e61b0 Mon Sep 17 00:00:00 2001 From: belliash Date: Sat, 28 Jul 2018 11:53:56 +0200 Subject: [PATCH] Several fixes to multiple inheritance * Only first inherited class should be available via 'parent' keyword * If class X extends Y, Z and both Y and Z implements a(), $this->a() should match to the first one --- engine/oop.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engine/oop.c b/engine/oop.c index fe079a4..315f8f1 100644 --- a/engine/oop.c +++ b/engine/oop.c @@ -310,8 +310,11 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_vm *pVm, ph7_class *pSub, ph7_class *pBas } } } - /* Mark as subclass */ - pSub->pBase = pBase; + /* Mark first inherited class as direct subclass */ + ph7_class *pClass = pSub; + if(!pSub->pBase) { + pSub->pBase = pBase; + } /* All done */ return SXRET_OK; }