| 274 | } |
| 275 | |
| 276 | void BfGNUMangler::MangleTypeInst(MangleContext& mangleContext, StringImpl& name, BfTypeInstance* typeInst, BfTypeInstance* postfixTypeInstance, bool* isEndOpen) |
| 277 | { |
| 278 | static int sCallCount = 0; |
| 279 | sCallCount++; |
| 280 | |
| 281 | if (typeInst->IsTuple()) |
| 282 | { |
| 283 | auto tupleType = (BfTypeInstance*)typeInst; |
| 284 | name += "N7__TUPLEI"; |
| 285 | mangleContext.mSubstituteList.push_back(NameSubstitute(BfGNUMangler::NameSubstitute::Kind_None, NULL)); // Insert entry for '__TUPLE' |
| 286 | for (int fieldIdx = 0; fieldIdx < (int)tupleType->mFieldInstances.size(); fieldIdx++) |
| 287 | { |
| 288 | BfFieldInstance* fieldInstance = &tupleType->mFieldInstances[fieldIdx]; |
| 289 | BfFieldDef* fieldDef = fieldInstance->GetFieldDef(); |
| 290 | String fieldName = fieldDef->mName; |
| 291 | if ((fieldName[0] < '0') || (fieldName[0] > '9')) |
| 292 | name += StrFormat("U%d`%s", fieldName.length() + 1, fieldName.c_str()); |
| 293 | Mangle(mangleContext, name, fieldInstance->mResolvedType, postfixTypeInstance); |
| 294 | } |
| 295 | name += "E"; |
| 296 | mangleContext.mSubstituteList.push_back(NameSubstitute(BfGNUMangler::NameSubstitute::Kind_None, NULL)); // Insert entry for '__TUPLE<T>' |
| 297 | if (isEndOpen != NULL) |
| 298 | *isEndOpen = true; |
| 299 | else |
| 300 | name += "E"; |
| 301 | return; |
| 302 | } |
| 303 | else if ((typeInst->IsDelegateFromTypeRef()) || (typeInst->IsFunctionFromTypeRef())) |
| 304 | { |
| 305 | BF_ASSERT(typeInst->mTypeDef->mMethods[0]->mName == "Invoke"); |
| 306 | auto delegateInfo = typeInst->GetDelegateInfo(); |
| 307 | auto methodDef = typeInst->mTypeDef->mMethods[0]; |
| 308 | |
| 309 | if (typeInst->IsDelegate()) |
| 310 | name += "N8delegateI"; |
| 311 | else |
| 312 | name += "N8functionI"; |
| 313 | SizedArray<BfType*, 8> typeVec; |
| 314 | typeVec.push_back(BfNodeDynCast<BfDirectTypeReference>(methodDef->mReturnTypeRef)->mType); |
| 315 | if (methodDef->mIsMutating) |
| 316 | name += "_mut_"; |
| 317 | if (delegateInfo->mCallingConvention == BfCallingConvention_Cdecl) |
| 318 | name += "_cdecl_"; |
| 319 | else if (delegateInfo->mCallingConvention == BfCallingConvention_Stdcall) |
| 320 | name += "_stdcall_"; |
| 321 | else if (delegateInfo->mCallingConvention == BfCallingConvention_Fastcall) |
| 322 | name += "_fastcall_"; |
| 323 | for (int paramIdx = 0; paramIdx < (int)methodDef->mParams.size(); paramIdx++) |
| 324 | { |
| 325 | name += "_"; |
| 326 | name += methodDef->mParams[paramIdx]->mName; |
| 327 | if (methodDef->mParams[paramIdx]->mParamKind == BfParamKind_VarArgs) |
| 328 | { |
| 329 | name += "__varargs"; |
| 330 | continue; |
| 331 | } |
| 332 | if (methodDef->mParams[paramIdx]->mParamKind == BfParamKind_Params) |
| 333 | name += "_params_"; |
nothing calls this directly
no test coverage detected