mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Removing code added during the migration. freeVariable(..) is called with
a `type` at all times.
This commit is contained in:
19
lib/scope.js
19
lib/scope.js
@@ -12,9 +12,7 @@
|
||||
this.expressions = _cache[1];
|
||||
this.method = _cache[2];
|
||||
this.variables = {};
|
||||
this.tempVars = {
|
||||
general: '_a'
|
||||
};
|
||||
this.tempVars = {};
|
||||
if (this.parent) {
|
||||
_cache2 = this.parent.tempVars;
|
||||
for (k in _cache2) {
|
||||
@@ -60,18 +58,9 @@
|
||||
};
|
||||
Scope.prototype.freeVariable = function(type) {
|
||||
var next;
|
||||
if (type) {
|
||||
next = function(prev) {
|
||||
return '_' + type + ((prev && Number(prev.match(/\d+$/) || 1) + 1) || '');
|
||||
};
|
||||
} else {
|
||||
type = 'general';
|
||||
next = function(prev) {
|
||||
var ordinal;
|
||||
ordinal = 1 + parseInt(prev.substr(1), 36);
|
||||
return '_' + ordinal.toString(36).replace(/\d/g, 'a');
|
||||
};
|
||||
}
|
||||
next = function(prev) {
|
||||
return '_' + type + ((prev && Number(prev.match(/\d+$/) || 1) + 1) || '');
|
||||
};
|
||||
while (this.check(this.tempVars[type] || (this.tempVars[type] = next()))) {
|
||||
this.tempVars[type] = next(this.tempVars[type]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user