Mercurial > projects > ldc
diff ir/irtypeclass.cpp @ 1245:465a77c904d4
Fixed all issues preventing Tango 0.99.8 to compile with `sh build-tango.sh --verbose ldc'.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Fri, 17 Apr 2009 14:38:29 +0200 |
parents | 212ec2d9d176 |
children | 752bed475b75 |
line wrap: on
line diff
--- a/ir/irtypeclass.cpp Fri Apr 17 03:01:43 2009 +0200 +++ b/ir/irtypeclass.cpp Fri Apr 17 14:38:29 2009 +0200 @@ -109,9 +109,7 @@ offset += PTRSIZE; // add to the interface map - // FIXME: and all it's baseinterfaces - if (interfaceMap.find(b->base) == interfaceMap.end()) - interfaceMap.insert(std::make_pair(b->base, field_index)); + addInterfaceToMap(b->base, field_index); field_index++; // inc count @@ -252,3 +250,22 @@ } ////////////////////////////////////////////////////////////////////////////// + +void IrTypeClass::addInterfaceToMap(ClassDeclaration * inter, size_t index) +{ + // don't duplicate work or overwrite indices + if (interfaceMap.find(inter) != interfaceMap.end()) + return; + + // add this interface + interfaceMap.insert(std::make_pair(inter, index)); + + // add all its base interfaces recursively + for (size_t i = 0; i < inter->interfaces_dim; i++) + { + BaseClass* b = inter->interfaces[i]; + addInterfaceToMap(b->base, index); + } +} + +//////////////////////////////////////////////////////////////////////////////