/* * Get the full size information for a class and its members. */ static void GetClassSize(ILSizeInfo *info, ILClass *classInfo) { ILImage *image = ILProgramItem_Image(classInfo); ILImplements *impl; ILClassLayout *layout; ILMember *member; int hasEvents, hasProperties; ILFieldLayout *fieldLayout; ILFieldRVA *fieldRVA; ILConstant *constant; ILUInt32 type; /* Get the size information for the class itself */ GetMetadataSizeWithAttrs(info, ILToProgramItem(classInfo)); /* Collect up size information for the interface declarations */ impl = 0; while((impl = ILClassNextImplements(classInfo, impl)) != 0) { GetMetadataSize(info, ILToProgramItem(impl)); } /* Account for class layout information */ layout = ILClassLayoutGetFromOwner(classInfo); if(layout) { GetMetadataSize(info, ILToProgramItem(layout)); } /* Account for the nested class declaration */ if(ILClass_NestedParent(classInfo) != 0) { info->meta += image->tokenSize[IL_META_TOKEN_NESTED_CLASS >> 24]; info->loadedMeta += sizeof(ILNestedInfo); }
/* * Get the total spanning size of an interface inheritance tree. */ static int GetSpanningSize(ILClass *interface) { int size = 1; ILImplements *impl = 0; while((impl = ILClassNextImplements(interface, impl)) != 0) { size += GetSpanningSize(ILClassResolve(ILImplementsGetInterface(impl))); } return size; }
/* * Determine if "classInfo" fully implements all parent interfaces * of "refClass". Note: Returns non-zero on error. */ static int ImplementsAllInterfaces(ILNode *node, ILClass *classInfo, ILClass *refClass, ILGenInterfaceErrorFunc error, ILGenInterfaceProxyFunc proxy, ILClass **visited, int *visitedSize) { ILImplements *impl = 0; int sawErrors = 0; while((impl = ILClassNextImplements(refClass, impl)) != 0) { sawErrors |= ImplementsInterface (node, classInfo, ILClassResolve(ILImplementsGetInterface(impl)), error, proxy, visited, visitedSize); } return sawErrors; }