private void setAttachedFunctions(PackageInfo packageInfo) { TypeDefInfo[] structInfoEntries = packageInfo.getTypeDefInfoEntries(); for (TypeDefInfo structInfo : structInfoEntries) { if (structInfo.typeTag == TypeTags.FINITE_TYPE_TAG) { continue; } StructureTypeInfo structureTypeInfo = (StructureTypeInfo) structInfo.typeInfo; BStructureType structType = structureTypeInfo.getType(); // Resolve attached function signature if (structType.getTag() != TypeTags.OBJECT_TYPE_TAG && structType.getTag() != TypeTags.RECORD_TYPE_TAG) { continue; } int attachedFuncCount = structureTypeInfo.funcInfoEntries.size(); BAttachedFunction[] attachedFunctions = new BAttachedFunction[attachedFuncCount]; int count = 0; for (FunctionInfo attachedFuncInfo : structureTypeInfo.funcInfoEntries.values()) { BAttachedFunction attachedFunction = new BAttachedFunction(attachedFuncInfo.name, attachedFuncInfo.funcType, attachedFuncInfo.flags); attachedFunctions[count++] = attachedFunction; if (structureTypeInfo.initializer == attachedFuncInfo) { structureTypeInfo.getType().initializer = attachedFunction; } } structureTypeInfo.getType().setAttachedFunctions(attachedFunctions); } }