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

Method CompactChildExpression

IDEHelper/WinDebugger.cpp:10866–10991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10864}
10865
10866String WinDebugger::CompactChildExpression(const StringImpl& expr, const StringImpl& parentExpr, int callStackIdx)
10867{
10868 DbgCompileUnit* compileUnit = GetCallStackCompileUnit(callStackIdx);
10869 DbgModule* dbgModule = GetCallStackDbgModule(callStackIdx);
10870 if (dbgModule == NULL)
10871 return "!failed";
10872
10873 DbgLanguage language = DbgLanguage_Unknown;
10874 if (compileUnit != NULL)
10875 language = compileUnit->mLanguage;
10876
10877 auto terminatedParentExpr = parentExpr + ";";
10878
10879 String parentPrefix;
10880
10881 int colonIdx = terminatedParentExpr.IndexOf(':');
10882 if (colonIdx > 0)
10883 {
10884 bool isValid = true;
10885 String lang = terminatedParentExpr.Substring(1, colonIdx - 1);
10886 lang = ToUpper(lang);
10887 if ((lang == "") || (lang == "BEEF"))
10888 {
10889 language = DbgLanguage_Beef;
10890 }
10891 else if (lang == "C")
10892 {
10893 language = DbgLanguage_C;
10894 }
10895 if (language != DbgLanguage_Unknown)
10896 {
10897 parentPrefix += terminatedParentExpr.Substring(0, colonIdx + 1);
10898 terminatedParentExpr.Remove(0, colonIdx + 1);
10899 }
10900 }
10901
10902 if (terminatedParentExpr.StartsWith('{'))
10903 {
10904 int prefixEnd = terminatedParentExpr.IndexOf('}');
10905 parentPrefix += terminatedParentExpr.Substring(0, prefixEnd + 1);
10906 terminatedParentExpr.Remove(0, prefixEnd + 1);
10907 }
10908
10909 BfPassInstance bfPassInstance(mBfSystem);
10910
10911 BfParser parser(mBfSystem);
10912 parser.mCompatMode = language != DbgLanguage_Beef;
10913 auto terminatedExpr = expr + ";";
10914 parser.SetSource(terminatedExpr.c_str(), terminatedExpr.length());
10915 parser.Parse(&bfPassInstance);
10916
10917 BfParser parentParser(mBfSystem);
10918 parentParser.mCompatMode = language != DbgLanguage_Beef;
10919 parentParser.SetSource(terminatedParentExpr.c_str(), terminatedParentExpr.length());
10920 parentParser.Parse(&bfPassInstance);
10921
10922 BfReducer bfReducer;
10923 bfReducer.mCompatMode = true;

Calls 15

BfVisitorPosClass · 0.85
SubstringMethod · 0.80
CreateExpressionMethod · 0.80
FailAtMethod · 0.80
IndexOfMethod · 0.45
RemoveMethod · 0.45
StartsWithMethod · 0.45
SetSourceMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
ParseMethod · 0.45

Tested by

no test coverage detected