1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Updating name for cached length temporary variables to '_length', 'length2', and

so on.
This commit is contained in:
Stan Angeloff 2010-09-20 08:42:31 +03:00
parent 31441868e0
commit 99a06ce4ea
11 changed files with 137 additions and 137 deletions

View file

@ -19,9 +19,9 @@
return xhr.send(null);
};
processScripts = function() {
var _cache, _cache2, _index, script;
var _cache, _index, _length, script;
_cache = document.getElementsByTagName('script');
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
script = _cache[_index];
if (script.type === 'text/coffeescript') {
if (script.src) {

View file

@ -35,7 +35,7 @@
});
exports.run = function() {
return path.exists('Cakefile', function(exists) {
var _cache, _cache2, _index, _result, arg, args;
var _cache, _index, _length, _result, arg, args;
if (!(exists)) {
throw new Error("Cakefile not found in " + (process.cwd()));
}
@ -49,7 +49,7 @@
}
options = oparse.parse(args);
_result = []; _cache = options.arguments;
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
arg = _cache[_index];
_result.push(invoke(arg));
}

View file

@ -53,9 +53,9 @@
return compileScripts();
};
compileScripts = function() {
var _cache2, _cache3, _index, _result;
var _cache2, _index, _length, _result;
_result = []; _cache2 = sources;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
(function() {
var base, compile;
var source = _cache2[_index];
@ -69,10 +69,10 @@
return fs.stat(source, function(err, stats) {
if (stats.isDirectory()) {
return fs.readdir(source, function(err, files) {
var _cache4, _cache5, _index2, _result2, file;
_result2 = []; _cache4 = files;
for (_index2 = 0, _cache5 = _cache4.length; _index2 < _cache5; _index2++) {
file = _cache4[_index2];
var _cache3, _index2, _length2, _result2, file;
_result2 = []; _cache3 = files;
for (_index2 = 0, _length2 = _cache3.length; _index2 < _length2; _index2++) {
file = _cache3[_index2];
_result2.push(compile(path.join(source, file)));
}
return _result2;
@ -95,12 +95,12 @@
return _result;
};
compileScript = function(file, input, base) {
var _cache2, _cache3, _index, o, options, req, t, task;
var _cache2, _index, _length, o, options, req, t, task;
o = opts;
options = compileOptions(file);
if (o.require) {
_cache2 = o.require;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
req = _cache2[_index];
require(helpers.starts(req, '.') ? fs.realpathSync(req) : req);
}
@ -204,15 +204,15 @@
return jsl.stdin.end();
};
printTokens = function(tokens) {
var _cache2, _cache3, _cache4, _index, _result, strings, tag, token, value;
var _cache2, _cache3, _index, _length, _result, strings, tag, token, value;
strings = (function() {
_result = []; _cache2 = tokens;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
token = _cache2[_index];
_result.push((function() {
_cache4 = [token[0], token[1].toString().replace(/\n/, '\\n')];
tag = _cache4[0];
value = _cache4[1];
_cache3 = [token[0], token[1].toString().replace(/\n/, '\\n')];
tag = _cache3[0];
value = _cache3[1];
return "[" + (tag) + " " + (value) + "]";
})());
}

View file

@ -1,5 +1,5 @@
(function() {
var Parser, _cache, _cache2, _cache3, _cache4, _cache5, _index, _index2, _result, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
var Parser, _cache, _cache2, _cache3, _index, _index2, _length, _length2, _result, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
var __hasProp = Object.prototype.hasOwnProperty;
Parser = require('jison').Parser;
unwrap = /function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
@ -618,12 +618,12 @@
alternatives = _cache[name];
grammar[name] = (function() {
_result = []; _cache2 = alternatives;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
alt = _cache2[_index];
_result.push((function() {
_cache4 = alt[0].split(' ');
for (_index2 = 0, _cache5 = _cache4.length; _index2 < _cache5; _index2++) {
token = _cache4[_index2];
_cache3 = alt[0].split(' ');
for (_index2 = 0, _length2 = _cache3.length; _index2 < _length2; _index2++) {
token = _cache3[_index2];
if (!(grammar[token])) {
tokens.push(token);
}

View file

@ -5,12 +5,12 @@
}
helpers = (exports.helpers = {});
helpers.indexOf = (indexOf = function(array, item, from) {
var _cache, _cache2, index, other;
var _cache, _length, index, other;
if (array.indexOf) {
return array.indexOf(item, from);
}
_cache = array;
for (index = 0, _cache2 = _cache.length; index < _cache2; index++) {
for (index = 0, _length = _cache.length; index < _length; index++) {
other = _cache[index];
if (other === item && (!from || (from <= index))) {
return index;
@ -30,9 +30,9 @@
return string.substring(start, start + literal.length) === literal;
});
helpers.compact = (compact = function(array) {
var _cache, _cache2, _index, _result, item;
var _cache, _index, _length, _result, item;
_result = []; _cache = array;
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
item = _cache[_index];
if (item) {
_result.push(item);
@ -77,10 +77,10 @@
return _result;
});
helpers.flatten = (flatten = function(array) {
var _cache, _cache2, _index, item, memo;
var _cache, _index, _length, item, memo;
memo = [];
_cache = array;
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
item = _cache[_index];
if (item instanceof Array) {
memo = memo.concat(item);

View file

@ -451,7 +451,7 @@
throw new Error("SyntaxError: Reserved word \"" + (this.value()) + "\" on line " + (this.line + 1) + " can't be assigned");
};
Lexer.prototype.balancedString = function(str, delimited, options) {
var _cache2, _cache3, _cache4, _index, close, i, levels, open, pair, slash;
var _cache2, _cache3, _index, _length, close, i, levels, open, pair, slash;
options || (options = {});
slash = delimited[0][0] === '/';
levels = [];
@ -461,11 +461,11 @@
i += 1;
} else {
_cache2 = delimited;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
pair = _cache2[_index];
_cache4 = pair;
open = _cache4[0];
close = _cache4[1];
_cache3 = pair;
open = _cache3[0];
close = _cache3[1];
if (levels.length && starts(str, close, i) && levels[levels.length - 1] === pair) {
levels.pop();
i += close.length - 1;
@ -494,7 +494,7 @@
return !i ? false : str.substring(0, i);
};
Lexer.prototype.interpolateString = function(str, options) {
var _cache2, _cache3, _cache4, escaped, expr, i, idx, inner, interpolated, lexer, nested, pi, quote, tag, tok, token, tokens, value;
var _cache2, _cache3, _length, escaped, expr, i, idx, inner, interpolated, lexer, nested, pi, quote, tag, tok, token, tokens, value;
options || (options = {});
if (str.length < 3 || !starts(str, '"')) {
return this.token('STRING', str);
@ -521,7 +521,7 @@
line: this.line
});
_cache2 = nested;
for (idx = 0, _cache3 = _cache2.length; idx < _cache3; idx++) {
for (idx = 0, _length = _cache2.length; idx < _length; idx++) {
tok = _cache2[idx];
if (tok[0] === 'CALL_END') {
(tok[0] = ')');
@ -548,11 +548,11 @@
this.token('(', '(');
}
_cache2 = tokens;
for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) {
for (i = 0, _length = _cache2.length; i < _length; i++) {
token = _cache2[i];
_cache4 = token;
tag = _cache4[0];
value = _cache4[1];
_cache3 = token;
tag = _cache3[0];
value = _cache3[1];
if (tag === 'TOKENS') {
this.tokens = this.tokens.concat(value);
} else if (tag === 'STRING' && options.escapeQuotes) {

View file

@ -109,11 +109,11 @@
return this.traverseChildren(true, block);
};
BaseNode.prototype.toString = function(idt, override) {
var _cache2, _cache3, _index, _result, child, children;
var _cache2, _index, _length, _result, child, children;
idt || (idt = '');
children = (function() {
_result = []; _cache2 = this.collectChildren();
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
child = _cache2[_index];
_result.push(child.toString(idt + TAB));
}
@ -122,17 +122,17 @@
return '\n' + idt + (override || this["class"]) + children;
};
BaseNode.prototype.eachChild = function(func) {
var _cache2, _cache3, _cache4, _cache5, _index, _index2, _result, attr, child;
var _cache2, _cache3, _index, _index2, _length, _length2, _result, attr, child;
if (!(this.children)) {
return null;
}
_result = []; _cache2 = this.children;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
attr = _cache2[_index];
if (this[attr]) {
_cache4 = flatten([this[attr]]);
for (_index2 = 0, _cache5 = _cache4.length; _index2 < _cache5; _index2++) {
child = _cache4[_index2];
_cache3 = flatten([this[attr]]);
for (_index2 = 0, _length2 = _cache3.length; _index2 < _length2; _index2++) {
child = _cache3[_index2];
if (func(child) === false) {
return null;
}
@ -217,10 +217,10 @@
return o.scope ? Expressions.__super__.compile.call(this, o) : this.compileRoot(o);
};
Expressions.prototype.compileNode = function(o) {
var _cache2, _cache3, _index, _result, node;
var _cache2, _index, _length, _result, node;
return (function() {
_result = []; _cache2 = this.expressions;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
node = _cache2[_index];
_result.push(this.compileExpression(node, merge(o)));
}
@ -362,7 +362,7 @@
return this.base instanceof LiteralNode && this.base.value.match(NUMBER);
};
ValueNode.prototype.cacheIndexes = function(o) {
var _cache2, _cache3, _index, copy, i;
var _cache2, _index, _length, copy, i;
copy = new ValueNode(this.base, this.properties.slice(0));
if (this.base instanceof CallNode) {
_cache2 = this.base.compileReference(o);
@ -370,17 +370,17 @@
copy.base = _cache2[1];
}
_cache2 = copy.properties;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
(function() {
var _cache4, index, indexVar;
var _cache3, index, indexVar;
var i = _index;
var prop = _cache2[_index];
if (prop instanceof IndexNode && prop.contains(function(n) {
return n instanceof CallNode;
})) {
_cache4 = prop.index.compileReference(o);
index = _cache4[0];
indexVar = _cache4[1];
_cache3 = prop.index.compileReference(o);
index = _cache3[0];
indexVar = _cache3[1];
this.properties[i] = new IndexNode(index);
return (copy.properties[i] = new IndexNode(indexVar));
}
@ -392,13 +392,13 @@
return !o.top || this.properties.length ? ValueNode.__super__.compile.call(this, o) : this.base.compile(o);
};
ValueNode.prototype.compileNode = function(o) {
var _cache2, _cache3, _index, baseline, complete, copy, hasSoak, i, me, only, op, part, prop, props, temp;
var _cache2, _index, _length, baseline, complete, copy, hasSoak, i, me, only, op, part, prop, props, temp;
only = del(o, 'onlyFirst');
op = this.tags.operation;
props = only ? this.properties.slice(0, this.properties.length - 1) : this.properties;
o.chainRoot || (o.chainRoot = this);
_cache2 = props;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
prop = _cache2[_index];
if (prop.soakNode) {
hasSoak = true;
@ -418,7 +418,7 @@
}
complete = (this.last = baseline);
_cache2 = props;
for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) {
for (i = 0, _length = _cache2.length; i < _length; i++) {
prop = _cache2[i];
this.source = baseline;
if (prop.soakNode) {
@ -504,7 +504,7 @@
})());
};
CallNode.prototype.compileNode = function(o) {
var _cache2, _cache3, _index, _result, arg, args, code, first, meth, methodAccessor, op;
var _cache2, _index, _length, _result, arg, args, code, first, meth, methodAccessor, op;
if (!(o.chainRoot)) {
o.chainRoot = this;
}
@ -530,7 +530,7 @@
this.meth = this.variable.compile(o);
}
_cache2 = this.args;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
arg = _cache2[_index];
if (arg instanceof SplatNode) {
code = this.compileSplat(o);
@ -539,7 +539,7 @@
if (!code) {
args = (function() {
_result = []; _cache2 = this.args;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
arg = _cache2[_index];
_result.push((function() {
arg.parenthetical = true;
@ -556,7 +556,7 @@
return "" + (this.superReference(o)) + ".call(this" + (args.length ? ', ' : '') + (args) + ")";
};
CallNode.prototype.compileSplat = function(o) {
var _cache2, _cache3, _index, a, b, c, mentionsArgs, meth, obj, temp;
var _cache2, _index, _length, a, b, c, mentionsArgs, meth, obj, temp;
meth = this.meth || this.superReference(o);
obj = this.variable && this.variable.source || 'this';
if (obj.match(/\(/)) {
@ -567,7 +567,7 @@
if (this.isNew) {
mentionsArgs = false;
_cache2 = this.args;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
(function() {
var arg = _cache2[_index];
return arg.contains(function(n) {
@ -773,12 +773,12 @@
return true;
};
ObjectNode.prototype.compileNode = function(o) {
var _cache2, _cache3, _index, _result, i, indent, join, lastNoncom, nonComments, obj, prop, props, top;
var _cache2, _index, _length, _result, i, indent, join, lastNoncom, nonComments, obj, prop, props, top;
top = del(o, 'top');
o.indent = this.idt(1);
nonComments = (function() {
_result = []; _cache2 = this.properties;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
prop = _cache2[_index];
if (!(prop instanceof CommentNode)) {
_result.push(prop);
@ -789,7 +789,7 @@
lastNoncom = nonComments[nonComments.length - 1];
props = (function() {
_result = []; _cache2 = this.properties;
for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) {
for (i = 0, _length = _cache2.length; i < _length; i++) {
prop = _cache2[i];
_result.push((function() {
join = ",\n";
@ -828,11 +828,11 @@
ArrayNode.prototype["class"] = 'ArrayNode';
ArrayNode.prototype.children = ['objects'];
ArrayNode.prototype.compileNode = function(o) {
var _cache2, _cache3, code, i, obj, objects;
var _cache2, _length, code, i, obj, objects;
o.indent = this.idt(1);
objects = [];
_cache2 = this.objects;
for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) {
for (i = 0, _length = _cache2.length; i < _length; i++) {
obj = _cache2[i];
code = obj.compile(o);
if (obj instanceof SplatNode) {
@ -871,7 +871,7 @@
return this;
};
ClassNode.prototype.compileNode = function(o) {
var _cache2, _cache3, _cache4, _index, access, applied, className, constScope, construct, constructor, extension, func, me, pname, prop, props, pvar, returns, val;
var _cache2, _cache3, _index, _length, access, applied, className, constScope, construct, constructor, extension, func, me, pname, prop, props, pvar, returns, val;
if (this.variable === '__temp__') {
this.variable = literal(o.scope.freeVariable('klass'));
}
@ -888,11 +888,11 @@
constructor = new CodeNode();
}
_cache2 = this.properties;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
prop = _cache2[_index];
_cache4 = [prop.variable, prop.value];
pvar = _cache4[0];
func = _cache4[1];
_cache3 = [prop.variable, prop.value];
pvar = _cache3[0];
func = _cache3[1];
if (pvar && pvar.base.value === 'constructor' && func instanceof CodeNode) {
if (func.bound) {
throw new Error("cannot define a constructor as a bound function.");
@ -1003,7 +1003,7 @@
return top || this.parenthetical ? val : ("(" + (val) + ")");
};
AssignNode.prototype.compilePatternMatch = function(o) {
var _cache2, _cache3, _cache4, accessClass, assigns, code, i, idx, isString, obj, oindex, olength, splat, val, valVar, value;
var _cache2, _cache3, _length, accessClass, assigns, code, i, idx, isString, obj, oindex, olength, splat, val, valVar, value;
valVar = o.scope.freeVariable('cache');
value = this.value.isStatement(o) ? ClosureNode.wrap(this.value) : this.value;
assigns = [("" + (this.tab) + (valVar) + " = " + (value.compile(o)) + ";")];
@ -1011,14 +1011,14 @@
o.asStatement = true;
splat = false;
_cache2 = this.variable.base.objects;
for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) {
for (i = 0, _length = _cache2.length; i < _length; i++) {
obj = _cache2[i];
idx = i;
if (this.variable.isObject()) {
if (obj instanceof AssignNode) {
_cache4 = [obj.value, obj.variable.base];
obj = _cache4[0];
idx = _cache4[1];
_cache3 = [obj.value, obj.variable.base];
obj = _cache3[0];
idx = _cache3[1];
} else {
idx = obj;
}
@ -1074,7 +1074,7 @@
CodeNode.prototype["class"] = 'CodeNode';
CodeNode.prototype.children = ['params', 'body'];
CodeNode.prototype.compileNode = function(o) {
var _cache2, _cache3, _cache4, _index, _result, code, empty, func, i, param, params, sharedScope, splat, top, value;
var _cache2, _cache3, _index, _length, _result, code, empty, func, i, param, params, sharedScope, splat, top, value;
sharedScope = del(o, 'sharedScope');
top = del(o, 'top');
o.scope = sharedScope || new Scope(o.scope, this.body, this);
@ -1086,7 +1086,7 @@
splat = undefined;
params = [];
_cache2 = this.params;
for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) {
for (i = 0, _length = _cache2.length; i < _length; i++) {
param = _cache2[i];
if (splat) {
if (param.attach) {
@ -1096,11 +1096,11 @@
splat.trailings.push(param);
} else {
if (param.attach) {
_cache4 = param;
value = _cache4.value;
_cache4 = [literal(o.scope.freeVariable('arg')), param.splat];
param = _cache4[0];
param.splat = _cache4[1];
_cache3 = param;
value = _cache3.value;
_cache3 = [literal(o.scope.freeVariable('arg')), param.splat];
param = _cache3[0];
param.splat = _cache3[1];
this.body.unshift(new AssignNode(new ValueNode(literal('this'), [new AccessorNode(value)]), param));
}
if (param.splat) {
@ -1116,7 +1116,7 @@
}
params = (function() {
_result = []; _cache2 = params;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
param = _cache2[_index];
_result.push(param.compile(o));
}
@ -1126,7 +1126,7 @@
this.body.makeReturn();
}
_cache2 = params;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
param = _cache2[_index];
(o.scope.parameter(param));
}
@ -1146,11 +1146,11 @@
}
};
CodeNode.prototype.toString = function(idt) {
var _cache2, _cache3, _index, _result, child, children;
var _cache2, _index, _length, _result, child, children;
idt || (idt = '');
children = (function() {
_result = []; _cache2 = this.collectChildren();
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
child = _cache2[_index];
_result.push(child.toString(idt + TAB));
}
@ -1197,18 +1197,18 @@
return (typeof (_cache2 = this.index) !== "undefined" && _cache2 !== null) ? this.compileParam(o) : this.name.compile(o);
};
SplatNode.prototype.compileParam = function(o) {
var _cache2, _cache3, assign, end, idx, len, name, pos, trailing, variadic;
var _cache2, _length, assign, end, idx, len, name, pos, trailing, variadic;
name = this.name.compile(o);
o.scope.find(name);
end = '';
if (this.trailings.length) {
len = o.scope.freeVariable('cache');
len = o.scope.freeVariable('length');
o.scope.assign(len, "arguments.length");
variadic = o.scope.freeVariable('result');
o.scope.assign(variadic, len + ' >= ' + this.arglength);
end = this.trailings.length ? (", " + (len) + " - " + (this.trailings.length)) : null;
_cache2 = this.trailings;
for (idx = 0, _cache3 = _cache2.length; idx < _cache3; idx++) {
for (idx = 0, _length = _cache2.length; idx < _length; idx++) {
trailing = _cache2[idx];
if (trailing.attach) {
assign = trailing.assign;
@ -1227,10 +1227,10 @@
return "" + (utility('slice')) + ".call(" + (name) + ", " + (index) + (trail) + ")";
};
SplatNode.compileSplattedArray = function(list, o) {
var _cache2, _cache3, arg, args, code, i, last, prev;
var _cache2, _length, arg, args, code, i, last, prev;
args = [];
_cache2 = list;
for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) {
for (i = 0, _length = _cache2.length; i < _length; i++) {
arg = _cache2[i];
code = arg.compile(o);
prev = args[(last = args.length - 1)];
@ -1458,10 +1458,10 @@
return this.isArray() ? this.compileOrTest(o) : this.compileLoopTest(o);
};
InNode.prototype.compileOrTest = function(o) {
var _cache2, _cache3, _result, i, item, tests;
var _cache2, _length, _result, i, item, tests;
tests = (function() {
_result = []; _cache2 = this.array.base.objects;
for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) {
for (i = 0, _length = _cache2.length; i < _length; i++) {
item = _cache2[i];
_result.push("" + (item.compile(o)) + " === " + (i ? this.obj2 : this.obj1));
}
@ -1476,7 +1476,7 @@
});
this.arr1 = _cache2[0];
this.arr2 = _cache2[1];
_cache2 = [o.scope.freeVariable('index'), o.scope.freeVariable('cache')];
_cache2 = [o.scope.freeVariable('index'), o.scope.freeVariable('length')];
i = _cache2[0];
l = _cache2[1];
prefix = this.obj1 !== this.obj2 ? this.obj1 + '; ' : '';
@ -1702,7 +1702,7 @@
}
}
if (!(this.object)) {
lvar = scope.freeVariable('cache');
lvar = scope.freeVariable('length');
stepPart = this.step ? ("" + (ivar) + " += " + (this.step.compile(o))) : ("" + (ivar) + "++");
forPart = ("" + (ivar) + " = 0, " + (lvar) + " = " + (svar) + ".length; " + (ivar) + " < " + (lvar) + "; " + (stepPart));
}
@ -1762,9 +1762,9 @@
return true;
};
SwitchNode.prototype.makeReturn = function() {
var _cache2, _cache3, _index, pair;
var _cache2, _index, _length, pair;
_cache2 = this.cases;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
pair = _cache2[_index];
pair[1].makeReturn();
}
@ -1774,20 +1774,20 @@
return this;
};
SwitchNode.prototype.compileNode = function(o) {
var _cache2, _cache3, _cache4, _cache5, _index, _index2, block, code, condition, conditions, exprs, idt, pair;
var _cache2, _cache3, _index, _index2, _length, _length2, block, code, condition, conditions, exprs, idt, pair;
idt = (o.indent = this.idt(1));
o.top = true;
code = ("" + (this.tab) + "switch (" + (this.subject.compile(o)) + ") {");
_cache2 = this.cases;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
pair = _cache2[_index];
_cache4 = pair;
conditions = _cache4[0];
block = _cache4[1];
_cache3 = pair;
conditions = _cache3[0];
block = _cache3[1];
exprs = block.expressions;
_cache4 = flatten([conditions]);
for (_index2 = 0, _cache5 = _cache4.length; _index2 < _cache5; _index2++) {
condition = _cache4[_index2];
_cache3 = flatten([conditions]);
for (_index2 = 0, _length2 = _cache3.length; _index2 < _length2; _index2++) {
condition = _cache3[_index2];
if (this.tags.subjectless) {
condition = new OpNode('!!', new ParentheticalNode(condition));
}
@ -1852,14 +1852,14 @@
return this.statement || (this.statement = (!!((o && o.top) || this.tags.statement || this.bodyNode().isStatement(o) || (this.elseBody && this.elseBodyNode().isStatement(o)))));
};
IfNode.prototype.compileCondition = function(o) {
var _cache2, _cache3, _index, _result, cond, conditions;
var _cache2, _index, _length, _result, cond, conditions;
conditions = flatten([this.condition]);
if (conditions.length === 1) {
conditions[0].parenthetical = true;
}
return (function() {
_result = []; _cache2 = conditions;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
cond = _cache2[_index];
_result.push(cond.compile(o));
}

View file

@ -7,19 +7,19 @@
return this;
};
OptionParser.prototype.parse = function(args) {
var _cache, _cache2, _cache3, _cache4, _index, arg, i, isOption, matchedRule, options, rule, value;
var _cache, _cache2, _index, _length, _length2, arg, i, isOption, matchedRule, options, rule, value;
options = {
arguments: []
};
args = normalizeArguments(args);
_cache = args;
for (i = 0, _cache2 = _cache.length; i < _cache2; i++) {
for (i = 0, _length = _cache.length; i < _length; i++) {
arg = _cache[i];
isOption = !!(arg.match(LONG_FLAG) || arg.match(SHORT_FLAG));
matchedRule = false;
_cache3 = this.rules;
for (_index = 0, _cache4 = _cache3.length; _index < _cache4; _index++) {
rule = _cache3[_index];
_cache2 = this.rules;
for (_index = 0, _length2 = _cache2.length; _index < _length2; _index++) {
rule = _cache2[_index];
if (rule.shortFlag === arg || rule.longFlag === arg) {
value = rule.hasArgument ? args[i += 1] : true;
options[rule.name] = rule.isList ? (options[rule.name] || []).concat(value) : value;
@ -38,13 +38,13 @@
return options;
};
OptionParser.prototype.help = function() {
var _cache, _cache2, _index, _result, i, letPart, lines, rule, spaces;
var _cache, _index, _length, _result, i, letPart, lines, rule, spaces;
lines = ['Available options:'];
if (this.banner) {
lines.unshift("" + (this.banner) + "\n");
}
_cache = this.rules;
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
rule = _cache[_index];
spaces = 15 - rule.longFlag.length;
spaces = spaces > 0 ? (function() {
@ -66,9 +66,9 @@
MULTI_FLAG = /^-(\w{2,})/;
OPTIONAL = /\[(\w+(\*?))\]/;
buildRules = function(rules) {
var _cache, _cache2, _index, _result, tuple;
var _cache, _index, _length, _result, tuple;
_result = []; _cache = rules;
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
tuple = _cache[_index];
_result.push((function() {
if (tuple.length < 3) {
@ -94,16 +94,16 @@
};
};
normalizeArguments = function(args) {
var _cache, _cache2, _cache3, _cache4, _index, _index2, arg, l, match, result;
var _cache, _cache2, _index, _index2, _length, _length2, arg, l, match, result;
args = args.slice(0);
result = [];
_cache = args;
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
arg = _cache[_index];
if (match = arg.match(MULTI_FLAG)) {
_cache3 = match[1].split('');
for (_index2 = 0, _cache4 = _cache3.length; _index2 < _cache4; _index2++) {
l = _cache3[_index2];
_cache2 = match[1].split('');
for (_index2 = 0, _length2 = _cache2.length; _index2 < _length2; _index2++) {
l = _cache2[_index2];
result.push('-' + l);
}
} else {

View file

@ -1,5 +1,5 @@
(function() {
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, LINEBREAKS, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, _cache, _cache2, _index, _result, helpers, include, pair;
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, LINEBREAKS, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, _cache, _index, _length, _result, helpers, include, pair;
var __hasProp = Object.prototype.hasOwnProperty;
if (typeof process !== "undefined" && process !== null) {
_cache = require('./helpers');
@ -291,13 +291,13 @@
levels = {};
openLine = {};
this.scanTokens(function(token, i) {
var _cache2, _cache3, _cache4, _index, close, open, pair;
var _cache2, _cache3, _index, _length, close, open, pair;
_cache2 = pairs;
for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) {
for (_index = 0, _length = _cache2.length; _index < _length; _index++) {
pair = _cache2[_index];
_cache4 = pair;
open = _cache4[0];
close = _cache4[1];
_cache3 = pair;
open = _cache3[0];
close = _cache3[1];
levels[open] || (levels[open] = 0);
if (token[0] === open) {
if (levels[open] === 0) {
@ -386,14 +386,14 @@
BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['PARAM_START', 'PARAM_END'], ['CALL_START', 'CALL_END'], ['INDEX_START', 'INDEX_END']];
INVERSES = {};
_cache = BALANCED_PAIRS;
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
pair = _cache[_index];
INVERSES[pair[0]] = pair[1];
INVERSES[pair[1]] = pair[0];
}
EXPRESSION_START = (function() {
_result = []; _cache = BALANCED_PAIRS;
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
pair = _cache[_index];
_result.push(pair[0]);
}
@ -401,7 +401,7 @@
})();
EXPRESSION_END = (function() {
_result = []; _cache = BALANCED_PAIRS;
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
pair = _cache[_index];
_result.push(pair[1]);
}

View file

@ -25,9 +25,9 @@
return this.garbage.push([]);
};
Scope.prototype.endLevel = function() {
var _cache, _cache2, _index, _result, name;
var _cache, _index, _length, _result, name;
_result = []; _cache = this.garbage.pop();
for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) {
for (_index = 0, _length = _cache.length; _index < _length; _index++) {
name = _cache[_index];
if (this.variables[name] === 'var') {
_result.push(this.variables[name] = 'reuse');

View file

@ -1014,7 +1014,7 @@ exports.SplatNode = class SplatNode extends BaseNode
o.scope.find name
end = ''
if @trailings.length
len = o.scope.freeVariable 'cache'
len = o.scope.freeVariable 'length'
o.scope.assign len, "arguments.length"
variadic = o.scope.freeVariable 'result'
o.scope.assign variadic, len + ' >= ' + @arglength
@ -1230,7 +1230,7 @@ exports.InNode = class InNode extends BaseNode
compileLoopTest: (o) ->
[@arr1, @arr2] = @array.compileReference o, precompile: yes
[i, l] = [o.scope.freeVariable('index'), o.scope.freeVariable('cache')]
[i, l] = [o.scope.freeVariable('index'), o.scope.freeVariable('length')]
prefix = if @obj1 isnt @obj2 then @obj1 + '; ' else ''
"(function(){ #{prefix}for (var #{i}=0, #{l}=#{@arr1}.length; #{i}<#{l}; #{i}++) { if (#{@arr2}[#{i}] === #{@obj2}) return true; } return false; }).call(this)"
@ -1408,7 +1408,7 @@ exports.ForNode = class ForNode extends BaseNode
else
namePart = "#{name} = #{svar}[#{ivar}]" if name
unless @object
lvar = scope.freeVariable 'cache'
lvar = scope.freeVariable 'length'
stepPart = if @step then "#{ivar} += #{ @step.compile(o) }" else "#{ivar}++"
forPart = "#{ivar} = 0, #{lvar} = #{svar}.length; #{ivar} < #{lvar}; #{stepPart}"
sourcePart = (if rvar then "#{rvar} = []; " else '') + sourcePart