s4s-vm / src /compiler /variable-pool.js
soiz1's picture
Upload 819 files
966637e verified
class VariablePool {
/**
* @param {string} prefix The prefix at the start of the variable name.
*/
constructor (prefix) {
if (prefix.trim().length === 0) {
throw new Error('prefix cannot be empty');
}
this.prefix = prefix;
/**
* @private
*/
this.count = 0;
}
next () {
return `${this.prefix}${this.count++}`;
}
}
module.exports = VariablePool;