Only increment the unique \@ ID when it is first used per context (#1030)

This avoids changes to generated `\@` labels just by adding or
removing macros or loops which do not actually use `\@`.

Fixes #1019
This commit is contained in:
Rangi
2022-08-31 17:45:21 -04:00
committed by GitHub
parent a52a00a9ca
commit c01317e08d
5 changed files with 88 additions and 6 deletions

View File

@@ -285,6 +285,9 @@ static void newContext(struct FileStackNode *fileInfo)
++contextDepth;
fstk_NewRecursionDepth(maxRecursionDepth); // Only checks if the max depth was exceeded
// Save the current `\@` value, to be restored when this context ends
contextStack->uniqueID = macro_GetUniqueID();
struct Context *context = malloc(sizeof(*context));
if (!context)