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

_result -> _results

This commit is contained in:
Jeremy Ashkenas 2010-11-09 00:17:08 -05:00
parent 14f86043cf
commit 9017b1ad3d
9 changed files with 71 additions and 71 deletions

View file

@ -33,7 +33,7 @@
});
exports.run = function() {
return path.exists('Cakefile', function(exists) {
var arg, args, _i, _len, _ref, _result;
var arg, args, _i, _len, _ref, _results;
if (!exists) {
throw new Error("Cakefile not found in " + (process.cwd()));
}
@ -47,12 +47,12 @@
}
options = oparse.parse(args);
_ref = options.arguments;
_result = [];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
arg = _ref[_i];
_result.push(invoke(arg));
_results.push(invoke(arg));
}
return _result;
return _results;
});
};
printTasks = function() {

View file

@ -49,7 +49,7 @@
return compileScripts();
};
compileScripts = function() {
var _fn, _i, _len, _ref, _result;
var _fn, _i, _len, _ref, _results;
_ref = sources;
_fn = function(source) {
var base, compile;
@ -62,13 +62,13 @@
return fs.stat(source, function(err, stats) {
if (stats.isDirectory()) {
return fs.readdir(source, function(err, files) {
var file, _i, _len, _result;
_result = [];
var file, _i, _len, _results;
_results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
_result.push(compile(path.join(source, file)));
_results.push(compile(path.join(source, file)));
}
return _result;
return _results;
});
} else if (topLevel || path.extname(source) === '.coffee') {
fs.readFile(source, function(err, code) {
@ -83,12 +83,12 @@
};
return compile(source, true);
};
_result = [];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
source = _ref[_i];
_result.push(_fn(source));
_results.push(_fn(source));
}
return _result;
return _results;
};
compileScript = function(file, input, base) {
var o, options, req, t, task, _i, _len, _ref;
@ -206,15 +206,15 @@
return jsl.stdin.end();
};
printTokens = function(tokens) {
var strings, tag, token, value, _i, _len, _ref, _result;
var strings, tag, token, value, _i, _len, _ref, _results;
strings = (function() {
_result = [];
_results = [];
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
token = tokens[_i];
_ref = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref[0], value = _ref[1];
_result.push("[" + tag + " " + value + "]");
_results.push("[" + tag + " " + value + "]");
}
return _result;
return _results;
})();
return console.log(strings.join(' '));
};

View file

@ -1,5 +1,5 @@
(function() {
var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap, _i, _j, _len, _len2, _ref, _result;
var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap, _i, _j, _len, _len2, _ref, _results;
Parser = require('jison').Parser;
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
o = function(patternString, action, options) {
@ -598,7 +598,7 @@
for (name in grammar) {
alternatives = grammar[name];
grammar[name] = (function() {
_result = [];
_results = [];
for (_i = 0, _len = alternatives.length; _i < _len; _i++) {
alt = alternatives[_i];
_ref = alt[0].split(' ');
@ -611,9 +611,9 @@
if (name === 'Root') {
alt[1] = "return " + alt[1];
}
_result.push(alt);
_results.push(alt);
}
return _result;
return _results;
})();
}
exports.parser = new Parser({

View file

@ -9,15 +9,15 @@
return literal === string.substr(string.length - len - (back || 0), len);
};
exports.compact = function(array) {
var item, _i, _len, _result;
_result = [];
var item, _i, _len, _results;
_results = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
item = array[_i];
if (item) {
_result.push(item);
_results.push(item);
}
}
return _result;
return _results;
};
exports.count = function(string, letter) {
var num, pos;

View file

@ -103,16 +103,16 @@
});
};
Base.prototype.toString = function(idt, override) {
var child, children, klass, _i, _len, _ref, _result;
var child, children, klass, _i, _len, _ref, _results;
idt == null && (idt = '');
children = ((function() {
_ref = this.collectChildren();
_result = [];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
_result.push(child.toString(idt + TAB));
_results.push(child.toString(idt + TAB));
}
return _result;
return _results;
}).call(this)).join('');
klass = override || this.constructor.name + (this.soak ? '?' : '');
return '\n' + idt + klass + children;
@ -604,7 +604,7 @@
return ifn;
};
Call.prototype.compileNode = function(o) {
var arg, args, code, _i, _len, _ref, _ref2, _result;
var arg, args, code, _i, _len, _ref, _ref2, _results;
if ((_ref = this.variable) != null) {
_ref.front = this.front;
}
@ -613,12 +613,12 @@
}
args = ((function() {
_ref2 = this.args;
_result = [];
_results = [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
arg = _ref2[_i];
_result.push(arg.compile(o, LEVEL_LIST));
_results.push(arg.compile(o, LEVEL_LIST));
}
return _result;
return _results;
}).call(this)).join(', ');
if (this.isSuper) {
return this.compileSuper(args, o);
@ -717,7 +717,7 @@
__extends(Obj, Base);
Obj.prototype.children = ['properties'];
Obj.prototype.compileNode = function(o) {
var i, idt, indent, join, lastNoncom, nonComments, obj, prop, props, rest, _i, _len, _len2, _ref, _result;
var i, idt, indent, join, lastNoncom, nonComments, obj, prop, props, rest, _i, _len, _len2, _ref, _results;
props = this.properties;
if (!props.length) {
if (this.front) {
@ -736,19 +736,19 @@
idt = o.indent += TAB;
nonComments = ((function() {
_ref = this.properties;
_result = [];
_results = [];
for (_i = 0, _len2 = _ref.length; _i < _len2; _i++) {
prop = _ref[_i];
if (!(prop instanceof Comment)) {
_result.push(prop);
_results.push(prop);
}
}
return _result;
return _results;
}).call(this));
lastNoncom = last(nonComments);
props = (function() {
_ref = this.properties;
_result = [];
_results = [];
for (i = 0, _len2 = _ref.length; i < _len2; i++) {
prop = _ref[i];
join = i === this.properties.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n';
@ -758,9 +758,9 @@
} else if (!(prop instanceof Assign) && !(prop instanceof Comment)) {
prop = new Assign(prop, prop, 'object');
}
_result.push(indent + prop.compile(o, LEVEL_TOP) + join);
_results.push(indent + prop.compile(o, LEVEL_TOP) + join);
}
return _result;
return _results;
}).call(this);
props = props.join('');
obj = "{" + (props && '\n' + props + '\n' + this.tab) + "}";
@ -827,7 +827,7 @@
__extends(Arr, Base);
Arr.prototype.children = ['objects'];
Arr.prototype.compileNode = function(o) {
var code, obj, _i, _len, _ref, _result;
var code, obj, _i, _len, _ref, _results;
if (!this.objects.length) {
return '[]';
}
@ -837,12 +837,12 @@
}
code = ((function() {
_ref = this.objects;
_result = [];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
obj = _ref[_i];
_result.push(obj.compile(o, LEVEL_LIST));
_results.push(obj.compile(o, LEVEL_LIST));
}
return _result;
return _results;
}).call(this)).join(', ');
if (code.indexOf('\n') >= 0) {
return "[\n" + o.indent + code + "\n" + this.tab + "]";
@ -1112,7 +1112,7 @@
__extends(Code, Base);
Code.prototype.children = ['params', 'body'];
Code.prototype.compileNode = function(o) {
var close, code, comm, exprs, func, i, idt, lit, open, p, param, ref, scope, sharedScope, splats, v, val, vars, wasEmpty, _i, _j, _len, _len2, _len3, _ref, _ref2, _result, _this;
var close, code, comm, exprs, func, i, idt, lit, open, p, param, ref, scope, sharedScope, splats, v, val, vars, wasEmpty, _i, _j, _len, _len2, _len3, _ref, _ref2, _results, _this;
sharedScope = del(o, 'sharedScope');
o.scope = scope = sharedScope || new Scope(o.scope, this.body, this);
o.indent += TAB;
@ -1126,12 +1126,12 @@
if (param.splat) {
splats = new Assign(new Value(new Arr((function() {
_ref2 = this.params;
_result = [];
_results = [];
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
p = _ref2[_j];
_result.push(p.asReference(o));
_results.push(p.asReference(o));
}
return _result;
return _results;
}).call(this))), new Value(new Literal('arguments')));
break;
}
@ -1259,7 +1259,7 @@
}
};
Splat.compileSplattedArray = function(o, list, apply) {
var args, base, code, i, index, node, _i, _len, _len2, _ref, _result;
var args, base, code, i, index, node, _i, _len, _len2, _ref, _results;
index = -1;
while ((node = list[++index]) && !(node instanceof Splat)) {
continue;
@ -1285,12 +1285,12 @@
}
base = ((function() {
_ref = list.slice(0, index);
_result = [];
_results = [];
for (_i = 0, _len2 = _ref.length; _i < _len2; _i++) {
node = _ref[_i];
_result.push(node.compile(o, LEVEL_LIST));
_results.push(node.compile(o, LEVEL_LIST));
}
return _result;
return _results;
})());
return "[" + (base.join(', ')) + "].concat(" + (args.join(', ')) + ")";
};
@ -1339,7 +1339,7 @@
body = '';
} else {
if (o.level > LEVEL_TOP || this.returns) {
rvar = o.scope.freeVariable('result');
rvar = o.scope.freeVariable('results');
set = "" + this.tab + rvar + " = [];\n";
if (body) {
body = Push.wrap(rvar, body);
@ -1489,17 +1489,17 @@
}
};
In.prototype.compileOrTest = function(o) {
var cmp, cnj, i, item, ref, sub, tests, _len, _ref, _ref2, _ref3, _result;
var cmp, cnj, i, item, ref, sub, tests, _len, _ref, _ref2, _ref3, _results;
_ref = this.object.cache(o, LEVEL_OP), sub = _ref[0], ref = _ref[1];
_ref2 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref2[0], cnj = _ref2[1];
tests = (function() {
_ref3 = this.array.base.objects;
_result = [];
_results = [];
for (i = 0, _len = _ref3.length; i < _len; i++) {
item = _ref3[i];
_result.push((i ? ref : sub) + cmp + item.compile(o, LEVEL_OP));
_results.push((i ? ref : sub) + cmp + item.compile(o, LEVEL_OP));
}
return _result;
return _results;
}).call(this);
tests = tests.join(cnj);
if (o.level < LEVEL_OP) {
@ -1765,7 +1765,7 @@
code = guardPart + varPart;
if (!body.isEmpty()) {
if (o.level > LEVEL_TOP || this.returns) {
rvar = scope.freeVariable('result');
rvar = scope.freeVariable('results');
defPart += this.tab + rvar + ' = [];\n';
retPart = this.compileReturnValue(rvar, o);
body = Push.wrap(rvar, body);

View file

@ -62,16 +62,16 @@
MULTI_FLAG = /^-(\w{2,})/;
OPTIONAL = /\[(\w+(\*?))\]/;
buildRules = function(rules) {
var tuple, _i, _len, _result;
_result = [];
var tuple, _i, _len, _results;
_results = [];
for (_i = 0, _len = rules.length; _i < _len; _i++) {
tuple = rules[_i];
if (tuple.length < 3) {
tuple.unshift(null);
}
_result.push(buildRule.apply(buildRule, tuple));
_results.push(buildRule.apply(buildRule, tuple));
}
return _result;
return _results;
};
buildRule = function(shortFlag, longFlag, description, options) {
var match;

View file

@ -258,7 +258,7 @@
});
};
exports.Rewriter.prototype.ensureBalance = function(pairs) {
var key, levels, open, openLine, unclosed, value, _result;
var key, levels, open, openLine, unclosed, value, _results;
levels = {};
openLine = {};
this.scanTokens(function(token, i) {
@ -282,14 +282,14 @@
return 1;
});
unclosed = ((function() {
_result = [];
_results = [];
for (key in levels) {
value = levels[key];
if (value > 0) {
_result.push(key);
_results.push(key);
}
}
return _result;
return _results;
})());
if (unclosed.length) {
throw Error("unclosed " + (open = unclosed[0]) + " on line " + (openLine[open] + 1));

View file

@ -141,16 +141,16 @@
return usr.sort().concat(tmp.sort());
};
Scope.prototype.assignedVariables = function() {
var v, _i, _len, _ref, _result;
var v, _i, _len, _ref, _results;
_ref = this.variables;
_result = [];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
v = _ref[_i];
if (v.type.assigned) {
_result.push("" + v.name + " = " + v.type.value);
_results.push("" + v.name + " = " + v.type.value);
}
}
return _result;
return _results;
};
Scope.prototype.compiledDeclarations = function() {
return this.declaredVariables().join(', ');

View file

@ -1016,7 +1016,7 @@ exports.While = class While extends Base
body = ''
else
if o.level > LEVEL_TOP or @returns
rvar = o.scope.freeVariable 'result'
rvar = o.scope.freeVariable 'results'
set = "#{@tab}#{rvar} = [];\n"
body = Push.wrap rvar, body if body
body = Expressions.wrap [new If @guard, body] if @guard
@ -1351,7 +1351,7 @@ exports.For = class For extends Base
code = guardPart + varPart
unless body.isEmpty()
if o.level > LEVEL_TOP or @returns
rvar = scope.freeVariable 'result'
rvar = scope.freeVariable 'results'
defPart += @tab + rvar + ' = [];\n'
retPart = @compileReturnValue rvar, o
body = Push.wrap rvar, body