removing unused reserved variable 'source var' from range comprehensions

This commit is contained in:
Jeremy Ashkenas 2010-03-27 16:04:47 -04:00
parent eaf4a71d32
commit 7de5253318
10 changed files with 125 additions and 125 deletions

View File

@ -62,9 +62,9 @@
return print_tasks();
}
options = oparse.parse(args);
_a = []; _b = options.arguments;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
arg = _b[_c];
_a = []; _c = options.arguments;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
arg = _c[_b];
_a.push(invoke(arg));
}
return _a;
@ -72,15 +72,15 @@
};
// Display the list of Cake tasks in a format similar to `rake -T`
print_tasks = function print_tasks() {
var _a, _b, _c, _d, _e, _f, i, name, spaces, task;
var _a, _b, _c, _d, _e, i, name, spaces, task;
puts('');
_a = tasks;
for (name in _a) { if (__hasProp.call(_a, name)) {
task = _a[name];
spaces = 20 - name.length;
spaces = spaces > 0 ? (function() {
_b = []; _e = 0; _f = spaces;
for (_d = 0, i = _e; (_e <= _f ? i <= _f : i >= _f); (_e <= _f ? i += 1 : i -= 1), _d++) {
_b = []; _d = 0; _e = spaces;
for (_c = 0, i = _d; (_d <= _e ? i <= _e : i >= _e); (_d <= _e ? i += 1 : i -= 1), _c++) {
_b.push(' ');
}
return _b;

View File

@ -95,9 +95,9 @@
if ((typeof document !== "undefined" && document !== null) && document.getElementsByTagName) {
process_scripts = function process_scripts() {
var _a, _b, _c, _d, tag;
_a = []; _b = document.getElementsByTagName('script');
for (_c = 0, _d = _b.length; _c < _d; _c++) {
tag = _b[_c];
_a = []; _c = document.getElementsByTagName('script');
for (_b = 0, _d = _c.length; _b < _d; _b++) {
tag = _c[_b];
tag.type === 'text/coffeescript' ? _a.push(eval(exports.compile(tag.innerHTML))) : null;
}
return _a;

View File

@ -68,9 +68,9 @@
});
});
};
_a = []; _b = sources;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
source = _b[_c];
_a = []; _c = sources;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
source = _c[_b];
_a.push(compile(source));
}
return _a;
@ -141,9 +141,9 @@
});
});
};
_a = []; _b = sources;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
source = _b[_c];
_a = []; _c = sources;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
source = _c[_b];
_a.push(watch(source));
}
return _a;
@ -180,9 +180,9 @@
print_tokens = function print_tokens(tokens) {
var _a, _b, _c, _d, _e, strings, tag, token, value;
strings = (function() {
_a = []; _b = tokens;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
token = _b[_c];
_a = []; _c = tokens;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
token = _c[_b];
_a.push((function() {
_e = [token[0], token[1].toString().replace(/\n/, '\\n')];
tag = _e[0];

View File

@ -629,13 +629,13 @@
for (name in _a) { if (__hasProp.call(_a, name)) {
alternatives = _a[name];
grammar[name] = (function() {
_b = []; _c = alternatives;
for (_d = 0, _e = _c.length; _d < _e; _d++) {
alt = _c[_d];
_b = []; _d = alternatives;
for (_c = 0, _e = _d.length; _c < _e; _c++) {
alt = _d[_c];
_b.push((function() {
_f = alt[0].split(' ');
for (_g = 0, _h = _f.length; _g < _h; _g++) {
token = _f[_g];
_g = alt[0].split(' ');
for (_f = 0, _h = _g.length; _f < _h; _f++) {
token = _g[_f];
if (!(grammar[token])) {
tokens.push(token);
}

View File

@ -20,9 +20,9 @@
// Trim out all falsy values from an array.
helpers.compact = (compact = function compact(array) {
var _a, _b, _c, _d, item;
_a = []; _b = array;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
item = _b[_c];
_a = []; _c = array;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
item = _c[_b];
item ? _a.push(item) : null;
}
return _a;
@ -74,9 +74,9 @@
helpers.flatten = (flatten = function flatten(array) {
var _a, _b, _c, item, memo;
memo = [];
_a = array;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
item = _a[_b];
_b = array;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
item = _b[_a];
item instanceof Array ? (memo = memo.concat(item)) : memo.push(item);
}
return memo;
@ -103,9 +103,9 @@
if (levels.length && starts(str, '\\', i)) {
i += 1;
} else {
_a = delimited;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
pair = _a[_b];
_b = delimited;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
pair = _b[_a];
_d = pair;
open = _d[0];
close = _d[1];

View File

@ -106,9 +106,9 @@
// as something else.
Lexer.prototype.extension_token = function extension_token() {
var _a, _b, _c, extension;
_a = Lexer.extensions;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
extension = _a[_b];
_b = Lexer.extensions;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
extension = _b[_a];
if (extension.call(this)) {
return true;
}

View File

@ -115,9 +115,9 @@
// scope boundaries.
BaseNode.prototype.contains = function contains(block) {
var _a, _b, _c, node;
_a = this.children;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
node = _a[_b];
_b = this.children;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
node = _b[_a];
if (block(node)) {
return true;
}
@ -137,9 +137,9 @@
// Perform an in-order traversal of the AST. Crosses scope boundaries.
BaseNode.prototype.traverse = function traverse(block) {
var _a, _b, _c, _d, node;
_a = []; _b = this.children;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
node = _b[_c];
_a = []; _c = this.children;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
node = _c[_b];
_a.push((function() {
block(node);
if (node.traverse) {
@ -155,9 +155,9 @@
var _a, _b, _c, _d, child;
idt = idt || '';
return '\n' + idt + this.type + (function() {
_a = []; _b = this.children;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
child = _b[_c];
_a = []; _c = this.children;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
child = _c[_b];
_a.push(child.toString(idt + TAB));
}
return _a;
@ -247,9 +247,9 @@
Expressions.prototype.compile_node = function compile_node(o) {
var _a, _b, _c, _d, node;
return (function() {
_a = []; _b = this.expressions;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
node = _b[_c];
_a = []; _c = this.expressions;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
node = _c[_b];
_a.push(this.compile_expression(node, merge(o)));
}
return _a;
@ -430,9 +430,9 @@
baseline = "(" + baseline + ")";
}
complete = (this.last = baseline);
_a = props;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
prop = _a[_b];
_b = props;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
prop = _b[_a];
this.source = baseline;
if (prop.soak_node) {
soaked = true;
@ -510,17 +510,17 @@
// Compile a vanilla function call.
CallNode.prototype.compile_node = function compile_node(o) {
var _a, _b, _c, _d, _e, _f, _g, arg, args;
_a = this.args;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
arg = _a[_b];
_b = this.args;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
arg = _b[_a];
if (arg instanceof SplatNode) {
return this.compile_splat(o);
}
}
args = (function() {
_d = []; _e = this.args;
for (_f = 0, _g = _e.length; _f < _g; _f++) {
arg = _e[_f];
_d = []; _f = this.args;
for (_e = 0, _g = _f.length; _e < _g; _e++) {
arg = _f[_e];
_d.push(arg.compile(o));
}
return _d;
@ -572,9 +572,9 @@
CurryNode.prototype.body = 'func.apply(obj, args.concat(Array.prototype.slice.call(arguments, 0)))';
CurryNode.prototype.arguments = function arguments(o) {
var _a, _b, _c, arg;
_a = this.args;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
arg = _a[_b];
_b = this.args;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
arg = _b[_a];
if (arg instanceof SplatNode) {
return this.compile_splat_arguments(o);
}
@ -743,9 +743,9 @@
var _a, _b, _c, _d, _e, _f, _g, i, indent, inner, join, last_noncom, non_comments, prop, props;
o.indent = this.idt(1);
non_comments = (function() {
_a = []; _b = this.properties;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
prop = _b[_c];
_a = []; _c = this.properties;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
prop = _c[_b];
!(prop instanceof CommentNode) ? _a.push(prop) : null;
}
return _a;
@ -838,9 +838,9 @@
constructor = null;
props = new Expressions();
o.top = true;
_a = this.properties;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
prop = _a[_b];
_b = this.properties;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
prop = _b[_a];
if (prop.variable && prop.variable.base.value === 'constructor') {
func = prop.value;
func.body.push(new ReturnNode(literal('this')));
@ -1022,9 +1022,9 @@
i = 0;
splat = undefined;
params = [];
_a = this.params;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
param = _a[_b];
_b = this.params;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
param = _b[_a];
if (param instanceof SplatNode && !(typeof splat !== "undefined" && splat !== null)) {
splat = param;
splat.index = i;
@ -1038,17 +1038,17 @@
i += 1;
}
params = (function() {
_d = []; _e = params;
for (_f = 0, _g = _e.length; _f < _g; _f++) {
param = _e[_f];
_d = []; _f = params;
for (_e = 0, _g = _f.length; _e < _g; _e++) {
param = _f[_e];
_d.push(param.compile(o));
}
return _d;
}).call(this);
this.body.make_return();
_h = params;
for (_i = 0, _j = _h.length; _i < _j; _i++) {
param = _h[_i];
_i = params;
for (_h = 0, _j = _i.length; _h < _j; _h++) {
param = _i[_h];
(o.scope.parameter(param));
}
code = this.body.expressions.length ? "\n" + (this.body.compile_with_declarations(o)) + "\n" : '';
@ -1075,9 +1075,9 @@
CodeNode.prototype.traverse = function traverse(block) {
var _a, _b, _c, _d, child;
block(this);
_a = []; _b = this.real_children();
for (_c = 0, _d = _b.length; _c < _d; _c++) {
child = _b[_c];
_a = []; _c = this.real_children();
for (_b = 0, _d = _c.length; _b < _d; _b++) {
child = _c[_b];
_a.push(child.traverse(block));
}
return _a;
@ -1086,9 +1086,9 @@
var _a, _b, _c, _d, child, children;
idt = idt || '';
children = (function() {
_a = []; _b = this.real_children();
for (_c = 0, _d = _b.length; _c < _d; _c++) {
child = _b[_c];
_a = []; _c = this.real_children();
for (_b = 0, _d = _c.length; _b < _d; _b++) {
child = _c[_b];
_a.push(child.toString(idt + TAB));
}
return _a;
@ -1125,9 +1125,9 @@
name = this.name.compile(o);
o.scope.find(name);
i = 0;
_a = this.trailings;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
trailing = _a[_b];
_b = this.trailings;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
trailing = _b[_a];
o.scope.assign(trailing.compile(o), "arguments[arguments.length - " + this.trailings.length + " + " + i + "]");
i += 1;
}
@ -1150,9 +1150,9 @@
var _a, _b, _c, arg, args, code, i, prev;
args = [];
i = 0;
_a = list;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
arg = _a[_b];
_b = list;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
arg = _b[_a];
code = arg.compile(o);
if (!(arg instanceof SplatNode)) {
prev = args[i - 1];
@ -1516,7 +1516,6 @@
if (!(top_level)) {
rvar = scope.free_variable();
}
svar = scope.free_variable();
ivar = range ? name : index || scope.free_variable();
var_part = '';
body = Expressions.wrap([this.body]);
@ -1529,6 +1528,7 @@
}));
for_part = "" + index_var + " = 0, " + for_part + ", " + index_var + "++";
} else {
svar = scope.free_variable();
index_var = null;
source_part = "" + svar + " = " + (this.source.compile(o)) + ";\n" + this.tab;
if (name) {
@ -1657,9 +1657,9 @@
IfNode.prototype.compile_condition = function compile_condition(o) {
var _a, _b, _c, _d, cond;
return (function() {
_a = []; _b = flatten([this.condition]);
for (_c = 0, _d = _b.length; _c < _d; _c++) {
cond = _b[_c];
_a = []; _c = flatten([this.condition]);
for (_b = 0, _d = _c.length; _b < _d; _b++) {
cond = _c[_b];
_a.push(cond.compile(o));
}
return _a;

View File

@ -27,9 +27,9 @@
while (arg = args.shift()) {
is_option = !!(arg.match(LONG_FLAG) || arg.match(SHORT_FLAG));
matched_rule = false;
_a = this.rules;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
rule = _a[_b];
_b = this.rules;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
rule = _b[_a];
if (rule.short_flag === arg || rule.long_flag === arg) {
options[rule.name] = rule.has_argument ? args.shift() : true;
matched_rule = true;
@ -48,18 +48,18 @@
// Return the help text for this **OptionParser**, listing and describing all
// of the valid options, for `--help` and such.
OptionParser.prototype.help = function help() {
var _a, _b, _c, _d, _e, _f, _g, _h, i, let_part, lines, rule, spaces;
var _a, _b, _c, _d, _e, _f, _g, i, let_part, lines, rule, spaces;
lines = ['Available options:'];
if (this.banner) {
lines.unshift("" + this.banner + "\n");
}
_a = this.rules;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
rule = _a[_b];
_b = this.rules;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
rule = _b[_a];
spaces = 15 - rule.long_flag.length;
spaces = spaces > 0 ? (function() {
_d = []; _g = 0; _h = spaces;
for (_f = 0, i = _g; (_g <= _h ? i <= _h : i >= _h); (_g <= _h ? i += 1 : i -= 1), _f++) {
_d = []; _f = 0; _g = spaces;
for (_e = 0, i = _f; (_f <= _g ? i <= _g : i >= _g); (_f <= _g ? i += 1 : i -= 1), _e++) {
_d.push(' ');
}
return _d;
@ -82,9 +82,9 @@
// unspecified, leave it out by padding with `null`.
build_rules = function build_rules(rules) {
var _a, _b, _c, _d, tuple;
_a = []; _b = rules;
for (_c = 0, _d = _b.length; _c < _d; _c++) {
tuple = _b[_c];
_a = []; _c = rules;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
tuple = _c[_b];
_a.push((function() {
if (tuple.length < 3) {
tuple.unshift(null);
@ -114,13 +114,13 @@
var _a, _b, _c, _d, _e, _f, arg, l, match, result;
args = args.slice(0);
result = [];
_a = args;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
arg = _a[_b];
_b = args;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
arg = _b[_a];
if ((match = arg.match(MULTI_FLAG))) {
_d = match[1].split('');
for (_e = 0, _f = _d.length; _e < _f; _e++) {
l = _d[_e];
_e = match[1].split('');
for (_d = 0, _f = _e.length; _d < _f; _d++) {
l = _e[_d];
result.push('-' + l);
}
} else {

View File

@ -155,7 +155,7 @@
calls = 0;
return this.scan_tokens((function(__this) {
var __func = function(prev, token, post, i) {
var _a, _b, _c, _d, idx, last, open, size, stack_pointer, tag, tmp;
var _a, _b, _c, idx, last, open, size, stack_pointer, tag, tmp;
tag = token[0];
if (tag === 'CALL_START') {
calls += 1;
@ -180,8 +180,8 @@
if (open || tag === 'INDENT') {
idx = tag === 'OUTDENT' ? i + 1 : i;
stack_pointer = tag === 'INDENT' ? 2 : 1;
_c = 0; _d = stack[stack.length - stack_pointer];
for (_b = 0, tmp = _c; (_c <= _d ? tmp < _d : tmp > _d); (_c <= _d ? tmp += 1 : tmp -= 1), _b++) {
_b = 0; _c = stack[stack.length - stack_pointer];
for (_a = 0, tmp = _b; (_b <= _c ? tmp < _c : tmp > _c); (_b <= _c ? tmp += 1 : tmp -= 1), _a++) {
this.tokens.splice(idx, 0, ['CALL_END', ')', token[2]]);
}
size = stack[stack.length - stack_pointer] + 1;
@ -253,9 +253,9 @@
this.scan_tokens((function(__this) {
var __func = function(prev, token, post, i) {
var _a, _b, _c, _d, close, open, pair;
_a = pairs;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
pair = _a[_b];
_b = pairs;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
pair = _b[_a];
_d = pair;
open = _d[0];
close = _d[1];
@ -355,26 +355,26 @@
// The inverse mappings of `BALANCED_PAIRS` we're trying to fix up, so we can
// look things up from either end.
INVERSES = {};
_a = BALANCED_PAIRS;
for (_b = 0, _c = _a.length; _b < _c; _b++) {
pair = _a[_b];
_b = BALANCED_PAIRS;
for (_a = 0, _c = _b.length; _a < _c; _a++) {
pair = _b[_a];
INVERSES[pair[0]] = pair[1];
INVERSES[pair[1]] = pair[0];
}
// The tokens that signal the start of a balanced pair.
EXPRESSION_START = (function() {
_d = []; _e = BALANCED_PAIRS;
for (_f = 0, _g = _e.length; _f < _g; _f++) {
pair = _e[_f];
_d = []; _f = BALANCED_PAIRS;
for (_e = 0, _g = _f.length; _e < _g; _e++) {
pair = _f[_e];
_d.push(pair[0]);
}
return _d;
}).call(this);
// The tokens that signal the end of a balanced pair.
EXPRESSION_END = (function() {
_h = []; _i = BALANCED_PAIRS;
for (_j = 0, _k = _i.length; _j < _k; _j++) {
pair = _i[_j];
_h = []; _j = BALANCED_PAIRS;
for (_i = 0, _k = _j.length; _i < _k; _i++) {
pair = _j[_i];
_h.push(pair[1]);
}
return _h;

View File

@ -1136,7 +1136,6 @@ exports.ForNode: class ForNode extends BaseNode
scope.find index if index
body_dent: @idt(1)
rvar: scope.free_variable() unless top_level
svar: scope.free_variable()
ivar: if range then name else index or scope.free_variable()
var_part: ''
body: Expressions.wrap([@body])
@ -1146,6 +1145,7 @@ exports.ForNode: class ForNode extends BaseNode
for_part: source.compile merge o, {index: ivar, step: @step}
for_part: "$index_var = 0, $for_part, $index_var++"
else
svar: scope.free_variable()
index_var: null
source_part: "$svar = ${ @source.compile(o) };\n$@tab"
var_part: "$body_dent$name = $svar[$ivar];\n" if name