From 349a6c1c3f63dc0680cffa09a6778557a3a85124 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Fri, 17 Dec 2010 12:55:28 +0300 Subject: [PATCH] Fixed calling of final methods of interfaces --- gen/toir.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gen/toir.cpp b/gen/toir.cpp index d65ee7ad..bc3a7767 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -1147,9 +1147,8 @@ DValue* DotVarExp::toElem(IRState* p) LLValue* vthis2 = 0; if (e1type->ty == Tclass) { TypeClass* tc = (TypeClass*)e1type; - if (tc->sym->isInterfaceDeclaration()) { + if (tc->sym->isInterfaceDeclaration() && !fdecl->isFinal()) vthis2 = DtoCastInterfaceToObject(l, NULL)->getRVal(); - } } LLValue* vthis = l->getRVal(); if (!vthis2) vthis2 = vthis; @@ -1157,7 +1156,7 @@ DValue* DotVarExp::toElem(IRState* p) // // decide whether this function needs to be looked up in the vtable // - bool vtbllookup = fdecl->isAbstract() || (!fdecl->isFinal() && fdecl->isVirtual()); + bool vtbllookup = !fdecl->isFinal() && (fdecl->isAbstract() || fdecl->isVirtual()); // even virtual functions are looked up directly if super or DotTypeExp // are used, thus we need to walk through the this expression and check