MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / ParsePropertyName

Method ParsePropertyName

source/Debugger.cpp:1373–1642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1371}
1372
1373int Debugger::ParsePropertyName(LPCSTR aFullName, int aDepth, int aVarScope, ExprTokenType *aSetValue
1374 , PropertySource &aResult)
1375{
1376 CStringTCharFromUTF8 name_buf(aFullName);
1377 LPTSTR name = name_buf.GetBuffer();
1378 size_t name_length;
1379 TCHAR c, *name_end, *src, *dst;
1380 Var *var = NULL;
1381 VarBkp *varbkp = NULL;
1382 SymbolType key_type;
1383
1384 aResult.kind = PropNone;
1385
1386 name_end = StrChrAny(name, _T(".["));
1387 if (name_end)
1388 {
1389 c = *name_end;
1390 *name_end = '\0'; // Temporarily terminate.
1391 }
1392 name_length = _tcslen(name);
1393
1394 // Validate name for more accurate error-reporting.
1395 if (name_length > MAX_VAR_NAME_LENGTH || !Var::ValidateName(name, DISPLAY_NO_ERROR))
1396 return DEBUGGER_E_INVALID_OPTIONS;
1397
1398 VarList *vars = nullptr;
1399 bool search_local = (aVarScope & VAR_LOCAL) && g->CurrentFunc;
1400 if (search_local && aDepth > 0)
1401 {
1402 VarList *static_vars = nullptr;
1403 VarBkp *bkps = nullptr, *bkps_end = nullptr;
1404 mStack.GetLocalVars(aDepth, vars, static_vars, bkps, bkps_end);
1405 for ( ; bkps < bkps_end; ++bkps)
1406 if (!_tcsicmp(bkps->mVar->mName, name))
1407 {
1408 varbkp = bkps;
1409 break;
1410 }
1411 if (!varbkp && static_vars)
1412 var = static_vars->Find(name);
1413 }
1414
1415 if (!var && !varbkp)
1416 {
1417 int insert_pos;
1418 if (vars) // Use this first to support aDepth.
1419 var = vars->Find(name, &insert_pos);
1420 if (!var) // Use FindVar to support built-ins and globals.
1421 var = g_script.FindVar(name, name_length, aVarScope, &vars, &insert_pos);
1422 if (!var && aSetValue) // Avoid creating empty variables.
1423 var = g_script.AddVar(name, name_length, vars, insert_pos
1424 , search_local ? VAR_LOCAL : VAR_GLOBAL);
1425 }
1426
1427 if (!var && !varbkp)
1428 return DEBUGGER_E_UNKNOWN_PROPERTY;
1429
1430 if (!name_end)

Callers

nothing calls this directly

Calls 15

StrChrAnyFunction · 0.85
IsNumericFunction · 0.85
GetBufferMethod · 0.80
GetLocalVarsMethod · 0.80
FindVarMethod · 0.80
AddVarMethod · 0.80
InitResultMethod · 0.80
SetValueMethod · 0.80
FreeExceptionTokenMethod · 0.80
istrtoi64Function · 0.70
FindMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected