Create a new method to return string name or number to DRY code.
This commit is contained in:
parent
0718e45c24
commit
bb63bd5e37
3 changed files with 12 additions and 19 deletions
|
|
@ -98,12 +98,8 @@ public:
|
|||
void location(const TSourceLoc& loc) {
|
||||
const int maxSize = 24;
|
||||
char locText[maxSize];
|
||||
if (loc.name != nullptr) {
|
||||
append(loc.name);
|
||||
snprintf(locText, maxSize, ":%d", loc.line);
|
||||
} else {
|
||||
snprintf(locText, maxSize, "%d:%d", loc.string, loc.line);
|
||||
}
|
||||
snprintf(locText, maxSize, ":%d", loc.line);
|
||||
append(loc.getStringNameOrNum(false).c_str());
|
||||
append(locText);
|
||||
append(": ");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue