MCPcopy Create free account
hub / github.com/beefytech/Beef / MatchMethod

Method MatchMethod

IDEHelper/DbgExprEvaluator.cpp:7497–8118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7495}
7496
7497DbgTypedValue DbgExprEvaluator::MatchMethod(BfAstNode* targetSrc, DbgTypedValue target, bool allowImplicitThis, bool bypassVirtual, const StringImpl& methodName,
7498 const BfSizedArray<ASTREF(BfExpression*)>& arguments, BfSizedArray<ASTREF(BfAstNode*)>* methodGenericArguments, bool& failed)
7499{
7500 SetAndRestoreValue<String*> prevReferenceId(mReferenceId, NULL);
7501
7502 bool wantCtor = methodName.IsEmpty();
7503
7504 mDbgModule->ParseGlobalsData();
7505 //mDbgModule->ParseSymbolData();
7506
7507 SizedArray<DbgTypedValue, 4> argValues;
7508 if (!ResolveArgValues(arguments, argValues))
7509 return DbgTypedValue();
7510
7511 if ((methodName == "__cast") || (methodName == "__bitcast"))
7512 {
7513 if (argValues.size() > 0)
7514 {
7515 String typeName = "";
7516 for (int argIdx = 0; argIdx < (int)argValues.size() - 1; argIdx++)
7517 {
7518 auto arg = argValues[argIdx];
7519 if (!arg)
7520 return DbgTypedValue();
7521 if ((arg.mType->IsPointer()) && ((arg.mType->mTypeParam->mTypeCode == DbgType_UChar) || (arg.mType->mTypeParam->mTypeCode == DbgType_SChar)))
7522 {
7523 typeName += arg.mCharPtr;
7524 }
7525 else if ((arg.mType->mTypeCode == DbgType_i32) || (arg.mType->mTypeCode == DbgType_i64))
7526 {
7527 if (typeName.IsEmpty())
7528 {
7529 // Fake this int as a type pointer
7530 arg.mSrcAddress = arg.mUInt64;
7531 BeefTypeToString(arg, typeName);
7532 }
7533 else
7534 typeName += BfTypeUtils::HashEncode64(arg.mInt64);
7535 }
7536 else
7537 {
7538 BeefTypeToString(arg, typeName);
7539 }
7540 }
7541
7542 auto castedType = mDbgModule->FindType(typeName, NULL, GetLanguage(), true);
7543 if (castedType == NULL)
7544 {
7545 if (typeName.EndsWith('*'))
7546 {
7547 auto noPtrTypeEntry = mDbgModule->FindType(typeName.Substring(0, typeName.length() - 1), NULL, DbgLanguage_Beef, true);
7548 if (noPtrTypeEntry != NULL)
7549 castedType = mDbgModule->GetPointerType(noPtrTypeEntry);
7550 }
7551 }
7552
7553 int targetArgIdx = argValues.size() - 1;
7554 if (castedType == NULL)

Callers

nothing calls this directly

Calls 15

DbgTypedValueClass · 0.85
HashEncode64Function · 0.85
FailFunction · 0.85
SubstringMethod · 0.80
GetPointerTypeMethod · 0.80
GetPrimaryTypeMethod · 0.80
GetByteCountMethod · 0.80
FindSubProgramMethod · 0.80
FindSymbolAtMethod · 0.80
GetInt64Method · 0.80
IsBfPayloadEnumMethod · 0.80
RemoveModifiersMethod · 0.80

Tested by

no test coverage detected