mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
_result -> _results
This commit is contained in:
parent
14f86043cf
commit
9017b1ad3d
9 changed files with 71 additions and 71 deletions
|
@ -33,7 +33,7 @@
|
||||||
});
|
});
|
||||||
exports.run = function() {
|
exports.run = function() {
|
||||||
return path.exists('Cakefile', function(exists) {
|
return path.exists('Cakefile', function(exists) {
|
||||||
var arg, args, _i, _len, _ref, _result;
|
var arg, args, _i, _len, _ref, _results;
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
throw new Error("Cakefile not found in " + (process.cwd()));
|
throw new Error("Cakefile not found in " + (process.cwd()));
|
||||||
}
|
}
|
||||||
|
@ -47,12 +47,12 @@
|
||||||
}
|
}
|
||||||
options = oparse.parse(args);
|
options = oparse.parse(args);
|
||||||
_ref = options.arguments;
|
_ref = options.arguments;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
arg = _ref[_i];
|
arg = _ref[_i];
|
||||||
_result.push(invoke(arg));
|
_results.push(invoke(arg));
|
||||||
}
|
}
|
||||||
return _result;
|
return _results;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
printTasks = function() {
|
printTasks = function() {
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
return compileScripts();
|
return compileScripts();
|
||||||
};
|
};
|
||||||
compileScripts = function() {
|
compileScripts = function() {
|
||||||
var _fn, _i, _len, _ref, _result;
|
var _fn, _i, _len, _ref, _results;
|
||||||
_ref = sources;
|
_ref = sources;
|
||||||
_fn = function(source) {
|
_fn = function(source) {
|
||||||
var base, compile;
|
var base, compile;
|
||||||
|
@ -62,13 +62,13 @@
|
||||||
return fs.stat(source, function(err, stats) {
|
return fs.stat(source, function(err, stats) {
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
return fs.readdir(source, function(err, files) {
|
return fs.readdir(source, function(err, files) {
|
||||||
var file, _i, _len, _result;
|
var file, _i, _len, _results;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
||||||
file = files[_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') {
|
} else if (topLevel || path.extname(source) === '.coffee') {
|
||||||
fs.readFile(source, function(err, code) {
|
fs.readFile(source, function(err, code) {
|
||||||
|
@ -83,12 +83,12 @@
|
||||||
};
|
};
|
||||||
return compile(source, true);
|
return compile(source, true);
|
||||||
};
|
};
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
source = _ref[_i];
|
source = _ref[_i];
|
||||||
_result.push(_fn(source));
|
_results.push(_fn(source));
|
||||||
}
|
}
|
||||||
return _result;
|
return _results;
|
||||||
};
|
};
|
||||||
compileScript = function(file, input, base) {
|
compileScript = function(file, input, base) {
|
||||||
var o, options, req, t, task, _i, _len, _ref;
|
var o, options, req, t, task, _i, _len, _ref;
|
||||||
|
@ -206,15 +206,15 @@
|
||||||
return jsl.stdin.end();
|
return jsl.stdin.end();
|
||||||
};
|
};
|
||||||
printTokens = function(tokens) {
|
printTokens = function(tokens) {
|
||||||
var strings, tag, token, value, _i, _len, _ref, _result;
|
var strings, tag, token, value, _i, _len, _ref, _results;
|
||||||
strings = (function() {
|
strings = (function() {
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
|
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
|
||||||
token = tokens[_i];
|
token = tokens[_i];
|
||||||
_ref = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref[0], value = _ref[1];
|
_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(' '));
|
return console.log(strings.join(' '));
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(function() {
|
(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;
|
Parser = require('jison').Parser;
|
||||||
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
|
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
|
||||||
o = function(patternString, action, options) {
|
o = function(patternString, action, options) {
|
||||||
|
@ -598,7 +598,7 @@
|
||||||
for (name in grammar) {
|
for (name in grammar) {
|
||||||
alternatives = grammar[name];
|
alternatives = grammar[name];
|
||||||
grammar[name] = (function() {
|
grammar[name] = (function() {
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = alternatives.length; _i < _len; _i++) {
|
for (_i = 0, _len = alternatives.length; _i < _len; _i++) {
|
||||||
alt = alternatives[_i];
|
alt = alternatives[_i];
|
||||||
_ref = alt[0].split(' ');
|
_ref = alt[0].split(' ');
|
||||||
|
@ -611,9 +611,9 @@
|
||||||
if (name === 'Root') {
|
if (name === 'Root') {
|
||||||
alt[1] = "return " + alt[1];
|
alt[1] = "return " + alt[1];
|
||||||
}
|
}
|
||||||
_result.push(alt);
|
_results.push(alt);
|
||||||
}
|
}
|
||||||
return _result;
|
return _results;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
exports.parser = new Parser({
|
exports.parser = new Parser({
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
return literal === string.substr(string.length - len - (back || 0), len);
|
return literal === string.substr(string.length - len - (back || 0), len);
|
||||||
};
|
};
|
||||||
exports.compact = function(array) {
|
exports.compact = function(array) {
|
||||||
var item, _i, _len, _result;
|
var item, _i, _len, _results;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = array.length; _i < _len; _i++) {
|
for (_i = 0, _len = array.length; _i < _len; _i++) {
|
||||||
item = array[_i];
|
item = array[_i];
|
||||||
if (item) {
|
if (item) {
|
||||||
_result.push(item);
|
_results.push(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _result;
|
return _results;
|
||||||
};
|
};
|
||||||
exports.count = function(string, letter) {
|
exports.count = function(string, letter) {
|
||||||
var num, pos;
|
var num, pos;
|
||||||
|
|
66
lib/nodes.js
66
lib/nodes.js
|
@ -103,16 +103,16 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Base.prototype.toString = function(idt, override) {
|
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 = '');
|
idt == null && (idt = '');
|
||||||
children = ((function() {
|
children = ((function() {
|
||||||
_ref = this.collectChildren();
|
_ref = this.collectChildren();
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
child = _ref[_i];
|
child = _ref[_i];
|
||||||
_result.push(child.toString(idt + TAB));
|
_results.push(child.toString(idt + TAB));
|
||||||
}
|
}
|
||||||
return _result;
|
return _results;
|
||||||
}).call(this)).join('');
|
}).call(this)).join('');
|
||||||
klass = override || this.constructor.name + (this.soak ? '?' : '');
|
klass = override || this.constructor.name + (this.soak ? '?' : '');
|
||||||
return '\n' + idt + klass + children;
|
return '\n' + idt + klass + children;
|
||||||
|
@ -604,7 +604,7 @@
|
||||||
return ifn;
|
return ifn;
|
||||||
};
|
};
|
||||||
Call.prototype.compileNode = function(o) {
|
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) {
|
if ((_ref = this.variable) != null) {
|
||||||
_ref.front = this.front;
|
_ref.front = this.front;
|
||||||
}
|
}
|
||||||
|
@ -613,12 +613,12 @@
|
||||||
}
|
}
|
||||||
args = ((function() {
|
args = ((function() {
|
||||||
_ref2 = this.args;
|
_ref2 = this.args;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||||
arg = _ref2[_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(', ');
|
}).call(this)).join(', ');
|
||||||
if (this.isSuper) {
|
if (this.isSuper) {
|
||||||
return this.compileSuper(args, o);
|
return this.compileSuper(args, o);
|
||||||
|
@ -717,7 +717,7 @@
|
||||||
__extends(Obj, Base);
|
__extends(Obj, Base);
|
||||||
Obj.prototype.children = ['properties'];
|
Obj.prototype.children = ['properties'];
|
||||||
Obj.prototype.compileNode = function(o) {
|
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;
|
props = this.properties;
|
||||||
if (!props.length) {
|
if (!props.length) {
|
||||||
if (this.front) {
|
if (this.front) {
|
||||||
|
@ -736,19 +736,19 @@
|
||||||
idt = o.indent += TAB;
|
idt = o.indent += TAB;
|
||||||
nonComments = ((function() {
|
nonComments = ((function() {
|
||||||
_ref = this.properties;
|
_ref = this.properties;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len2 = _ref.length; _i < _len2; _i++) {
|
for (_i = 0, _len2 = _ref.length; _i < _len2; _i++) {
|
||||||
prop = _ref[_i];
|
prop = _ref[_i];
|
||||||
if (!(prop instanceof Comment)) {
|
if (!(prop instanceof Comment)) {
|
||||||
_result.push(prop);
|
_results.push(prop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _result;
|
return _results;
|
||||||
}).call(this));
|
}).call(this));
|
||||||
lastNoncom = last(nonComments);
|
lastNoncom = last(nonComments);
|
||||||
props = (function() {
|
props = (function() {
|
||||||
_ref = this.properties;
|
_ref = this.properties;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (i = 0, _len2 = _ref.length; i < _len2; i++) {
|
for (i = 0, _len2 = _ref.length; i < _len2; i++) {
|
||||||
prop = _ref[i];
|
prop = _ref[i];
|
||||||
join = i === this.properties.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n';
|
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)) {
|
} else if (!(prop instanceof Assign) && !(prop instanceof Comment)) {
|
||||||
prop = new Assign(prop, prop, 'object');
|
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);
|
}).call(this);
|
||||||
props = props.join('');
|
props = props.join('');
|
||||||
obj = "{" + (props && '\n' + props + '\n' + this.tab) + "}";
|
obj = "{" + (props && '\n' + props + '\n' + this.tab) + "}";
|
||||||
|
@ -827,7 +827,7 @@
|
||||||
__extends(Arr, Base);
|
__extends(Arr, Base);
|
||||||
Arr.prototype.children = ['objects'];
|
Arr.prototype.children = ['objects'];
|
||||||
Arr.prototype.compileNode = function(o) {
|
Arr.prototype.compileNode = function(o) {
|
||||||
var code, obj, _i, _len, _ref, _result;
|
var code, obj, _i, _len, _ref, _results;
|
||||||
if (!this.objects.length) {
|
if (!this.objects.length) {
|
||||||
return '[]';
|
return '[]';
|
||||||
}
|
}
|
||||||
|
@ -837,12 +837,12 @@
|
||||||
}
|
}
|
||||||
code = ((function() {
|
code = ((function() {
|
||||||
_ref = this.objects;
|
_ref = this.objects;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
obj = _ref[_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(', ');
|
}).call(this)).join(', ');
|
||||||
if (code.indexOf('\n') >= 0) {
|
if (code.indexOf('\n') >= 0) {
|
||||||
return "[\n" + o.indent + code + "\n" + this.tab + "]";
|
return "[\n" + o.indent + code + "\n" + this.tab + "]";
|
||||||
|
@ -1112,7 +1112,7 @@
|
||||||
__extends(Code, Base);
|
__extends(Code, Base);
|
||||||
Code.prototype.children = ['params', 'body'];
|
Code.prototype.children = ['params', 'body'];
|
||||||
Code.prototype.compileNode = function(o) {
|
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');
|
sharedScope = del(o, 'sharedScope');
|
||||||
o.scope = scope = sharedScope || new Scope(o.scope, this.body, this);
|
o.scope = scope = sharedScope || new Scope(o.scope, this.body, this);
|
||||||
o.indent += TAB;
|
o.indent += TAB;
|
||||||
|
@ -1126,12 +1126,12 @@
|
||||||
if (param.splat) {
|
if (param.splat) {
|
||||||
splats = new Assign(new Value(new Arr((function() {
|
splats = new Assign(new Value(new Arr((function() {
|
||||||
_ref2 = this.params;
|
_ref2 = this.params;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
|
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
|
||||||
p = _ref2[_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')));
|
}).call(this))), new Value(new Literal('arguments')));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1259,7 +1259,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Splat.compileSplattedArray = function(o, list, apply) {
|
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;
|
index = -1;
|
||||||
while ((node = list[++index]) && !(node instanceof Splat)) {
|
while ((node = list[++index]) && !(node instanceof Splat)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1285,12 +1285,12 @@
|
||||||
}
|
}
|
||||||
base = ((function() {
|
base = ((function() {
|
||||||
_ref = list.slice(0, index);
|
_ref = list.slice(0, index);
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len2 = _ref.length; _i < _len2; _i++) {
|
for (_i = 0, _len2 = _ref.length; _i < _len2; _i++) {
|
||||||
node = _ref[_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(', ')) + ")";
|
return "[" + (base.join(', ')) + "].concat(" + (args.join(', ')) + ")";
|
||||||
};
|
};
|
||||||
|
@ -1339,7 +1339,7 @@
|
||||||
body = '';
|
body = '';
|
||||||
} else {
|
} else {
|
||||||
if (o.level > LEVEL_TOP || this.returns) {
|
if (o.level > LEVEL_TOP || this.returns) {
|
||||||
rvar = o.scope.freeVariable('result');
|
rvar = o.scope.freeVariable('results');
|
||||||
set = "" + this.tab + rvar + " = [];\n";
|
set = "" + this.tab + rvar + " = [];\n";
|
||||||
if (body) {
|
if (body) {
|
||||||
body = Push.wrap(rvar, body);
|
body = Push.wrap(rvar, body);
|
||||||
|
@ -1489,17 +1489,17 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
In.prototype.compileOrTest = function(o) {
|
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];
|
_ref = this.object.cache(o, LEVEL_OP), sub = _ref[0], ref = _ref[1];
|
||||||
_ref2 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref2[0], cnj = _ref2[1];
|
_ref2 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref2[0], cnj = _ref2[1];
|
||||||
tests = (function() {
|
tests = (function() {
|
||||||
_ref3 = this.array.base.objects;
|
_ref3 = this.array.base.objects;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (i = 0, _len = _ref3.length; i < _len; i++) {
|
for (i = 0, _len = _ref3.length; i < _len; i++) {
|
||||||
item = _ref3[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);
|
}).call(this);
|
||||||
tests = tests.join(cnj);
|
tests = tests.join(cnj);
|
||||||
if (o.level < LEVEL_OP) {
|
if (o.level < LEVEL_OP) {
|
||||||
|
@ -1765,7 +1765,7 @@
|
||||||
code = guardPart + varPart;
|
code = guardPart + varPart;
|
||||||
if (!body.isEmpty()) {
|
if (!body.isEmpty()) {
|
||||||
if (o.level > LEVEL_TOP || this.returns) {
|
if (o.level > LEVEL_TOP || this.returns) {
|
||||||
rvar = scope.freeVariable('result');
|
rvar = scope.freeVariable('results');
|
||||||
defPart += this.tab + rvar + ' = [];\n';
|
defPart += this.tab + rvar + ' = [];\n';
|
||||||
retPart = this.compileReturnValue(rvar, o);
|
retPart = this.compileReturnValue(rvar, o);
|
||||||
body = Push.wrap(rvar, body);
|
body = Push.wrap(rvar, body);
|
||||||
|
|
|
@ -62,16 +62,16 @@
|
||||||
MULTI_FLAG = /^-(\w{2,})/;
|
MULTI_FLAG = /^-(\w{2,})/;
|
||||||
OPTIONAL = /\[(\w+(\*?))\]/;
|
OPTIONAL = /\[(\w+(\*?))\]/;
|
||||||
buildRules = function(rules) {
|
buildRules = function(rules) {
|
||||||
var tuple, _i, _len, _result;
|
var tuple, _i, _len, _results;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = rules.length; _i < _len; _i++) {
|
for (_i = 0, _len = rules.length; _i < _len; _i++) {
|
||||||
tuple = rules[_i];
|
tuple = rules[_i];
|
||||||
if (tuple.length < 3) {
|
if (tuple.length < 3) {
|
||||||
tuple.unshift(null);
|
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) {
|
buildRule = function(shortFlag, longFlag, description, options) {
|
||||||
var match;
|
var match;
|
||||||
|
|
|
@ -258,7 +258,7 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
exports.Rewriter.prototype.ensureBalance = function(pairs) {
|
exports.Rewriter.prototype.ensureBalance = function(pairs) {
|
||||||
var key, levels, open, openLine, unclosed, value, _result;
|
var key, levels, open, openLine, unclosed, value, _results;
|
||||||
levels = {};
|
levels = {};
|
||||||
openLine = {};
|
openLine = {};
|
||||||
this.scanTokens(function(token, i) {
|
this.scanTokens(function(token, i) {
|
||||||
|
@ -282,14 +282,14 @@
|
||||||
return 1;
|
return 1;
|
||||||
});
|
});
|
||||||
unclosed = ((function() {
|
unclosed = ((function() {
|
||||||
_result = [];
|
_results = [];
|
||||||
for (key in levels) {
|
for (key in levels) {
|
||||||
value = levels[key];
|
value = levels[key];
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
_result.push(key);
|
_results.push(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _result;
|
return _results;
|
||||||
})());
|
})());
|
||||||
if (unclosed.length) {
|
if (unclosed.length) {
|
||||||
throw Error("unclosed " + (open = unclosed[0]) + " on line " + (openLine[open] + 1));
|
throw Error("unclosed " + (open = unclosed[0]) + " on line " + (openLine[open] + 1));
|
||||||
|
|
|
@ -141,16 +141,16 @@
|
||||||
return usr.sort().concat(tmp.sort());
|
return usr.sort().concat(tmp.sort());
|
||||||
};
|
};
|
||||||
Scope.prototype.assignedVariables = function() {
|
Scope.prototype.assignedVariables = function() {
|
||||||
var v, _i, _len, _ref, _result;
|
var v, _i, _len, _ref, _results;
|
||||||
_ref = this.variables;
|
_ref = this.variables;
|
||||||
_result = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
v = _ref[_i];
|
v = _ref[_i];
|
||||||
if (v.type.assigned) {
|
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() {
|
Scope.prototype.compiledDeclarations = function() {
|
||||||
return this.declaredVariables().join(', ');
|
return this.declaredVariables().join(', ');
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ exports.While = class While extends Base
|
||||||
body = ''
|
body = ''
|
||||||
else
|
else
|
||||||
if o.level > LEVEL_TOP or @returns
|
if o.level > LEVEL_TOP or @returns
|
||||||
rvar = o.scope.freeVariable 'result'
|
rvar = o.scope.freeVariable 'results'
|
||||||
set = "#{@tab}#{rvar} = [];\n"
|
set = "#{@tab}#{rvar} = [];\n"
|
||||||
body = Push.wrap rvar, body if body
|
body = Push.wrap rvar, body if body
|
||||||
body = Expressions.wrap [new If @guard, body] if @guard
|
body = Expressions.wrap [new If @guard, body] if @guard
|
||||||
|
@ -1351,7 +1351,7 @@ exports.For = class For extends Base
|
||||||
code = guardPart + varPart
|
code = guardPart + varPart
|
||||||
unless body.isEmpty()
|
unless body.isEmpty()
|
||||||
if o.level > LEVEL_TOP or @returns
|
if o.level > LEVEL_TOP or @returns
|
||||||
rvar = scope.freeVariable 'result'
|
rvar = scope.freeVariable 'results'
|
||||||
defPart += @tab + rvar + ' = [];\n'
|
defPart += @tab + rvar + ' = [];\n'
|
||||||
retPart = @compileReturnValue rvar, o
|
retPart = @compileReturnValue rvar, o
|
||||||
body = Push.wrap rvar, body
|
body = Push.wrap rvar, body
|
||||||
|
|
Loading…
Reference in a new issue