MCPcopy Index your code
hub / github.com/nodejs/node / makeTempVariableName

Function makeTempVariableName

test/fixtures/snapshot/typescript.js:114527–114554  ·  view source on GitHub ↗

* Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict.

(flags, reservedInNestedScopes)

Source from the content-addressed store, hash-verified

114525 * Note that names generated by makeTempVariableName and makeUniqueName will never conflict.
114526 */
114527 function makeTempVariableName(flags, reservedInNestedScopes) {
114528 if (flags && !(tempFlags & flags)) {
114529 var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n";
114530 if (isUniqueName(name)) {
114531 tempFlags |= flags;
114532 if (reservedInNestedScopes) {
114533 reserveNameInNestedScopes(name);
114534 }
114535 return name;
114536 }
114537 }
114538 while (true) {
114539 var count = tempFlags & 268435455 /* TempFlags.CountMask */;
114540 tempFlags++;
114541 // Skip over 'i' and 'n'
114542 if (count !== 8 && count !== 13) {
114543 var name = count < 26
114544 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count)
114545 : "_" + (count - 26);
114546 if (isUniqueName(name)) {
114547 if (reservedInNestedScopes) {
114548 reserveNameInNestedScopes(name);
114549 }
114550 return name;
114551 }
114552 }
114553 }
114554 }
114555 /**
114556 * Generate a name that is unique within the current file and doesn't conflict with any names
114557 * in global scope. The name is formed by adding an '_n' suffix to the specified base name,

Callers 3

generateNameForNodeFunction · 0.85
makeNameFunction · 0.85

Calls 2

isUniqueNameFunction · 0.85

Tested by

no test coverage detected