| 395 | } |
| 396 | |
| 397 | DebugVisualizerEntry* DebugVisualizers::FindEntryForType(const StringImpl& typeName, DbgFlavor wantFlavor, Array<String>* wildcardCaptures) |
| 398 | { |
| 399 | //TODO: Do smarter name matching. Right now we just compare up to the '*' |
| 400 | |
| 401 | for (auto entry : mDebugVisualizers) |
| 402 | { |
| 403 | if ((entry->mFlavor != DbgFlavor_Unknown) && (entry->mFlavor != wantFlavor)) |
| 404 | continue; |
| 405 | |
| 406 | const char* entryCharP = entry->mName.c_str(); |
| 407 | const char* typeCharP = typeName.c_str(); |
| 408 | bool isTemplate = false; |
| 409 | |
| 410 | while (true) |
| 411 | { |
| 412 | while (*typeCharP == ' ') |
| 413 | typeCharP++; |
| 414 | while (*entryCharP == ' ') |
| 415 | entryCharP++; |
| 416 | |
| 417 | char typeC = *typeCharP; |
| 418 | char entryC = *entryCharP; |
| 419 | |
| 420 | if (typeC == 0) |
| 421 | { |
| 422 | if (entryC == 0) |
| 423 | return entry; |
| 424 | break; |
| 425 | } |
| 426 | else if (entryC == 0) |
| 427 | break; |
| 428 | |
| 429 | if (entryC == '<') |
| 430 | isTemplate = true; |
| 431 | |
| 432 | if (entryC == '*') |
| 433 | { |
| 434 | int openDepth = 0; |
| 435 | String wildcardCapture; |
| 436 | while (true) |
| 437 | { |
| 438 | typeC = *typeCharP; |
| 439 | |
| 440 | bool isSep = typeC == ','; |
| 441 | if ((!isTemplate) && ((typeC == '[') || (typeC == '?'))) |
| 442 | isSep = true; |
| 443 | |
| 444 | if (typeC == 0) |
| 445 | break; |
| 446 | if ((typeC == '<') || (typeC == '(')) |
| 447 | openDepth++; |
| 448 | else if ((typeC == '>') || (typeC == ')')) |
| 449 | { |
| 450 | openDepth--; |
| 451 | if (openDepth < 0) |
| 452 | { |
| 453 | typeCharP--; |
| 454 | break; |
no test coverage detected