modified satyr -- made temp vars be declared later.

This commit is contained in:
Jeremy Ashkenas 2010-11-01 23:58:03 -04:00
parent 5aa21c363d
commit b0e7c3e3e7
12 changed files with 87 additions and 85 deletions

View File

@ -26,7 +26,7 @@
return xhr.send(null);
};
runScripts = function() {
var _i, _len, _ref, script;
var script, _i, _len, _ref;
_ref = document.getElementsByTagName('script');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
script = _ref[_i];

View File

@ -33,7 +33,7 @@
});
exports.run = function() {
return path.exists('Cakefile', function(exists) {
var _i, _len, _ref, _result, arg, args;
var arg, args, _i, _len, _ref, _result;
if (!exists) {
throw new Error("Cakefile not found in " + (process.cwd()));
}
@ -56,7 +56,7 @@
});
};
printTasks = function() {
var _ref, desc, name, spaces, task;
var desc, name, spaces, task, _ref;
console.log('');
for (name in _ref = tasks) {
task = _ref[name];

View File

@ -1,5 +1,5 @@
(function() {
var ALL_SWITCHES, BANNER, CoffeeScript, DEPRECATED_SWITCHES, EventEmitter, SWITCHES, _ref, compileOptions, compileScript, compileScripts, compileStdio, exec, fs, helpers, lint, optionParser, optparse, opts, parseOptions, path, printTokens, sources, spawn, usage, version, watch, writeJs;
var ALL_SWITCHES, BANNER, CoffeeScript, DEPRECATED_SWITCHES, EventEmitter, SWITCHES, compileOptions, compileScript, compileScripts, compileStdio, exec, fs, helpers, lint, optionParser, optparse, opts, parseOptions, path, printTokens, sources, spawn, usage, version, watch, writeJs, _ref;
fs = require('fs');
path = require('path');
optparse = require('./optparse');
@ -50,7 +50,7 @@
return compileScripts();
};
compileScripts = function() {
var _i, _len, _ref2, _result, base, compile, source;
var base, compile, source, _i, _len, _ref2, _result;
_ref2 = sources;
_result = [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
@ -64,7 +64,7 @@
return fs.stat(source, function(err, stats) {
if (stats.isDirectory()) {
return fs.readdir(source, function(err, files) {
var _j, _len2, _result2, file;
var file, _j, _len2, _result2;
_result2 = [];
for (_j = 0, _len2 = files.length; _j < _len2; _j++) {
file = files[_j];
@ -86,7 +86,7 @@
return _result;
};
compileScript = function(file, input, base) {
var _i, _len, _ref2, o, options, req, t, task;
var o, options, req, t, task, _i, _len, _ref2;
o = opts;
options = compileOptions(file);
if (o.require) {
@ -185,7 +185,7 @@
return jsl.stdin.end();
};
printTokens = function(tokens) {
var _i, _len, _ref2, _result, strings, tag, token, value;
var strings, tag, token, value, _i, _len, _ref2, _result;
strings = (function() {
_result = [];
for (_i = 0, _len = tokens.length; _i < _len; _i++) {

View File

@ -1,5 +1,5 @@
(function() {
var Parser, _i, _j, _len, _len2, _ref, _result, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap, _i, _j, _len, _len2, _ref, _result;
Parser = require('jison').Parser;
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
o = function(patternString, action, options) {

View File

@ -9,7 +9,7 @@
return literal === string.substr(string.length - len - (back || 0), len);
};
exports.compact = function(array) {
var _i, _len, _result, item;
var item, _i, _len, _result;
_result = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
item = array[_i];
@ -39,7 +39,7 @@
return object;
};
exports.flatten = flatten = function(array) {
var _i, _len, element, flattened;
var element, flattened, _i, _len;
flattened = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
element = array[_i];

View File

@ -1,5 +1,5 @@
(function() {
var _ref, key, val;
var key, val, _ref;
var __hasProp = Object.prototype.hasOwnProperty;
for (key in _ref = require('./coffee-script')) {
if (!__hasProp.call(_ref, key)) continue;

View File

@ -1,5 +1,5 @@
(function() {
var ASSIGNED, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LEADING_SPACES, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, TRAILING_SPACES, UNARY, WHITESPACE, _ref, compact, count, last, op, starts;
var ASSIGNED, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LEADING_SPACES, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, last, op, starts, _ref;
var __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
@ -38,7 +38,7 @@
return (new Rewriter).rewrite(this.tokens);
};
Lexer.prototype.identifierToken = function() {
var _ref2, _ref3, colon, forcedIdentifier, id, input, match, prev, tag;
var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3;
if (!(match = IDENTIFIER.exec(this.chunk))) {
return 0;
}
@ -182,7 +182,7 @@
return script.length;
};
Lexer.prototype.regexToken = function() {
var _ref2, match, regex;
var match, regex, _ref2;
if (this.chunk.charAt(0) !== '/') {
return 0;
}
@ -200,7 +200,7 @@
return regex.length;
};
Lexer.prototype.heregexToken = function(match) {
var _i, _len, _ref2, _ref3, _this, body, flags, heregex, re, tag, tokens, value;
var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref2, _ref3, _this;
heregex = match[0], body = match[1], flags = match[2];
if (0 > body.indexOf('#{')) {
re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/');
@ -324,7 +324,7 @@
return this;
};
Lexer.prototype.literalToken = function() {
var _ref2, _ref3, _ref4, _ref5, match, prev, tag, value;
var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
if (match = OPERATOR.exec(this.chunk)) {
value = match[0];
if (CODE.test(value)) {
@ -380,7 +380,7 @@
return value.length;
};
Lexer.prototype.sanitizeHeredoc = function(doc, options) {
var _ref2, attempt, herecomment, indent, match;
var attempt, herecomment, indent, match, _ref2;
indent = options.indent, herecomment = options.herecomment;
if (herecomment && 0 > doc.indexOf('\n')) {
return doc;
@ -437,7 +437,7 @@
throw SyntaxError("Reserved word \"" + (this.value()) + "\" on line " + (this.line + 1) + " can't be assigned");
};
Lexer.prototype.balancedString = function(str, delimited, options) {
var _i, _len, close, i, levels, open, pair, slen;
var close, i, levels, open, pair, slen, _i, _len;
options == null && (options = {});
levels = [];
i = 0;
@ -475,7 +475,7 @@
return i && str.slice(0, i);
};
Lexer.prototype.interpolateString = function(str, options) {
var _len, _ref2, _this, expr, heredoc, i, inner, interpolated, letter, nested, pi, regex, tag, tokens, value;
var expr, heredoc, i, inner, interpolated, letter, nested, pi, regex, tag, tokens, value, _len, _ref2, _this;
options == null && (options = {});
heredoc = options.heredoc, regex = options.regex;
tokens = [];

View File

@ -1,5 +1,5 @@
(function() {
var Accessor, Arr, Assign, Base, Call, Class, Closure, Code, Comment, Existence, Expressions, Extends, For, IDENTIFIER, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, NO, NUMBER, Obj, Op, Param, Parens, Push, Return, SIMPLENUM, Scope, Splat, Switch, TAB, THIS, TRAILING_WHITESPACE, Throw, Try, UTILITIES, Value, While, YES, _ref, compact, del, ends, extend, flatten, last, merge, multident, starts, utility;
var Accessor, Arr, Assign, Base, Call, Class, Closure, Code, Comment, Existence, Expressions, Extends, For, IDENTIFIER, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, NO, NUMBER, Obj, Op, Param, Parens, Push, Return, SIMPLENUM, Scope, Splat, Switch, TAB, THIS, TRAILING_WHITESPACE, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, starts, utility, _ref;
var __extends = function(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
@ -92,7 +92,7 @@
});
};
Base.prototype.toString = function(idt, override) {
var _i, _len, _ref2, _result, child, children, klass;
var child, children, klass, _i, _len, _ref2, _result;
idt == null && (idt = '');
children = ((function() {
_ref2 = this.collectChildren();
@ -107,7 +107,7 @@
return '\n' + idt + klass + children;
};
Base.prototype.eachChild = function(func) {
var _i, _j, _len, _len2, _ref2, _ref3, attr, child;
var attr, child, _i, _j, _len, _len2, _ref2, _ref3;
if (!this.children) {
return this;
}
@ -193,7 +193,7 @@
return !this.expressions.length;
};
Expressions.prototype.makeReturn = function() {
var _ref2, end, idx;
var end, idx, _ref2;
_ref2 = this.expressions;
for (idx = _ref2.length - 1; idx >= 0; idx--) {
end = _ref2[idx];
@ -209,7 +209,7 @@
return o.scope ? Expressions.__super__.compile.call(this, o, level) : this.compileRoot(o);
};
Expressions.prototype.compileNode = function(o) {
var _i, _len, _ref2, _result, node;
var node, _i, _len, _ref2, _result;
this.tab = o.indent;
return ((function() {
_ref2 = this.expressions;
@ -304,7 +304,7 @@
Return.prototype.isPureStatement = YES;
Return.prototype.makeReturn = THIS;
Return.prototype.compile = function(o, level) {
var _ref2, expr;
var expr, _ref2;
expr = (_ref2 = this.expression) != null ? _ref2.makeReturn() : void 0;
return expr && !(expr instanceof Return) ? expr.compile(o, level) : Return.__super__.compile.call(this, o, level);
};
@ -354,7 +354,7 @@
return this.base instanceof Literal && SIMPLENUM.test(this.base.value);
};
Value.prototype.isAtomic = function() {
var _i, _len, _ref2, node;
var node, _i, _len, _ref2;
_ref2 = this.properties.concat(this.base);
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
node = _ref2[_i];
@ -398,7 +398,7 @@
return [base.push(name), new Value(bref || base.base, [nref || name])];
};
Value.prototype.compileNode = function(o) {
var _i, _len, code, prop, props;
var code, prop, props, _i, _len;
this.base.front = this.front;
props = this.properties;
code = this.base.compile(o, props.length ? LEVEL_ACCESS : null);
@ -412,7 +412,7 @@
return code;
};
Value.prototype.unfoldSoak = function(o) {
var _len, _ref2, fst, i, ifn, prop, ref, snd;
var fst, i, ifn, prop, ref, snd, _len, _ref2;
if (ifn = this.base.unfoldSoak(o)) {
Array.prototype.push.apply(ifn.body.properties, this.properties);
return ifn;
@ -486,7 +486,7 @@
return method.klass ? "" + method.klass + ".__super__." + name : "" + name + ".__super__.constructor";
};
Call.prototype.unfoldSoak = function(o) {
var _i, _len, _ref2, _ref3, call, ifn, left, list, rite;
var call, ifn, left, list, rite, _i, _len, _ref2, _ref3;
if (this.soak) {
if (this.variable) {
if (ifn = If.unfoldSoak(o, this, 'variable')) {
@ -535,7 +535,7 @@
return ifn;
};
Call.prototype.compileNode = function(o) {
var _i, _len, _ref2, _ref3, _result, arg, args, code;
var arg, args, code, _i, _len, _ref2, _ref3, _result;
if ((_ref2 = this.variable) != null) {
_ref2.front = this.front;
}
@ -644,7 +644,7 @@
__extends(Obj, Base);
Obj.prototype.children = ['properties'];
Obj.prototype.compileNode = function(o) {
var _i, _len, _len2, _ref2, _ref3, _result, i, idt, indent, join, lastNoncom, nonComments, obj, prop, props, rest;
var i, idt, indent, join, lastNoncom, nonComments, obj, prop, props, rest, _i, _len, _len2, _ref2, _ref3, _result;
_ref2 = this.properties;
for (i = 0, _len = _ref2.length; i < _len; i++) {
prop = _ref2[i];
@ -690,7 +690,7 @@
return this.front ? "(" + obj + ")" : obj;
};
Obj.prototype.compileDynamic = function(o, code, props) {
var _len, _ref2, acc, i, key, oref, prop, ref, val;
var acc, i, key, oref, prop, ref, val, _len, _ref2;
code = "" + (oref = o.scope.freeVariable('obj')) + " = " + code + ", ";
for (i = 0, _len = props.length; i < _len; i++) {
prop = props[i];
@ -716,7 +716,7 @@
return o.level <= LEVEL_PAREN ? code : "(" + code + ")";
};
Obj.prototype.assigns = function(name) {
var _i, _len, _ref2, prop;
var prop, _i, _len, _ref2;
_ref2 = this.properties;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
prop = _ref2[_i];
@ -739,7 +739,7 @@
__extends(Arr, Base);
Arr.prototype.children = ['objects'];
Arr.prototype.compileNode = function(o) {
var _len, _ref2, code, i, obj, objects;
var code, i, obj, objects, _len, _ref2;
o.indent = this.idt(1);
if (code = Splat.compileSplattedArray(o, this.objects)) {
return code;
@ -755,7 +755,7 @@
return 0 < objects.indexOf('\n') ? "[\n" + o.indent + objects + "\n" + this.tab + "]" : "[" + objects + "]";
};
Arr.prototype.assigns = function(name) {
var _i, _len, _ref2, obj;
var obj, _i, _len, _ref2;
_ref2 = this.objects;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
obj = _ref2[_i];
@ -785,7 +785,7 @@
return this;
};
Class.prototype.compileNode = function(o) {
var _i, _len, _ref2, _ref3, access, applied, apply, className, code, constScope, ctor, extension, func, me, pname, prop, props, pvar, ref, ret, val, variable;
var access, applied, apply, className, code, constScope, ctor, extension, func, me, pname, prop, props, pvar, ref, ret, val, variable, _i, _len, _ref2, _ref3;
variable = this.variable || new Literal(o.scope.freeVariable('ctor'));
extension = this.parent && new Extends(variable, this.parent);
props = new Expressions;
@ -885,7 +885,7 @@
return If.unfoldSoak(o, this, 'variable');
};
Assign.prototype.compileNode = function(o) {
var _ref2, isValue, match, name, val;
var isValue, match, name, val, _ref2;
if (isValue = this.variable instanceof Value) {
if (this.variable.isArray() || this.variable.isObject()) {
return this.compilePatternMatch(o);
@ -913,7 +913,7 @@
return o.level <= LEVEL_LIST ? val : "(" + val + ")";
};
Assign.prototype.compilePatternMatch = function(o) {
var _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, acc, assigns, code, i, idx, isObject, ivar, obj, objects, olen, ref, rest, splat, top, val, value, vvar;
var acc, assigns, code, i, idx, isObject, ivar, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
top = o.level === LEVEL_TOP;
value = this.value;
objects = this.variable.base.objects;
@ -989,7 +989,7 @@
return o.level < LEVEL_LIST ? code : "(" + code + ")";
};
Assign.prototype.compileConditional = function(o) {
var _ref2, left, rite;
var left, rite, _ref2;
_ref2 = this.variable.cacheReference(o), left = _ref2[0], rite = _ref2[1];
return new Op(this.context.slice(0, -1), left, new Assign(rite, this.value, '=')).compile(o);
};
@ -1011,7 +1011,7 @@
__extends(Code, Base);
Code.prototype.children = ['params', 'body'];
Code.prototype.compileNode = function(o) {
var _i, _j, _len, _len2, _len3, _ref2, _ref3, _result, _this, close, code, comm, exprs, func, i, idt, lit, open, p, param, ref, scope, sharedScope, splats, v, val, vars, wasEmpty;
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, _ref2, _ref3, _result, _this;
sharedScope = del(o, 'sharedScope');
o.scope = scope = sharedScope || new Scope(o.scope, this.body, this);
o.indent = this.idt(1);
@ -1148,7 +1148,7 @@
return this.index != null ? this.compileParam(o) : this.name.compile(o);
};
Splat.compileSplattedArray = function(o, list, apply) {
var _i, _len, _len2, _ref2, _result, args, base, code, i, index, node;
var args, base, code, i, index, node, _i, _len, _len2, _ref2, _result;
index = -1;
while ((node = list[++index]) && !(node instanceof Splat)) {
continue;
@ -1206,7 +1206,7 @@
return this;
};
While.prototype.containsPureStatement = function() {
var _ref2, expressions, i, ret;
var expressions, i, ret, _ref2;
expressions = this.body.expressions;
i = expressions.length;
if ((_ref2 = expressions[--i]) != null ? _ref2.containsPureStatement() : void 0) {
@ -1316,7 +1316,7 @@
return "" + (this.first.compile(o, LEVEL_OP)) + " " + this.operator + " " + (this.second.compile(o, LEVEL_OP));
};
Op.prototype.compileChain = function(o) {
var _ref2, code, fst, shared;
var code, fst, shared, _ref2;
_ref2 = this.first.second.cache(o), this.first.second = _ref2[0], shared = _ref2[1];
fst = this.first.compile(o, LEVEL_OP);
if (fst.charAt(0) === '(') {
@ -1372,7 +1372,7 @@
return this.array instanceof Value && this.array.isArray() ? this.compileOrTest(o) : this.compileLoopTest(o);
};
In.prototype.compileOrTest = function(o) {
var _len, _ref2, _ref3, _ref4, _result, cmp, cnj, i, item, ref, sub, tests;
var cmp, cnj, i, item, ref, sub, tests, _len, _ref2, _ref3, _ref4, _result;
_ref2 = this.object.cache(o, LEVEL_OP), sub = _ref2[0], ref = _ref2[1];
_ref3 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref3[0], cnj = _ref3[1];
tests = (function() {
@ -1388,7 +1388,7 @@
return o.level < LEVEL_OP ? tests : "(" + tests + ")";
};
In.prototype.compileLoopTest = function(o) {
var _ref2, code, ref, sub;
var code, ref, sub, _ref2;
_ref2 = this.object.cache(o, LEVEL_LIST), sub = _ref2[0], ref = _ref2[1];
code = utility('indexOf') + (".call(" + (this.array.compile(o)) + ", " + ref + ") ") + (this.negated ? '< 0' : '>= 0');
if (sub === ref) {
@ -1536,7 +1536,7 @@
return '';
};
For.prototype.compileNode = function(o) {
var _ref2, _ref3, _ref4, _ref5, _ref6, body, code, cond, defPart, forPart, guardPart, idt, index, ivar, lvar, name, namePart, pvar, retPart, rvar, scope, sourcePart, step, svar, tail, tvar, varPart, vars;
var body, code, cond, defPart, forPart, guardPart, idt, index, ivar, lvar, name, namePart, pvar, retPart, rvar, scope, sourcePart, step, svar, tail, tvar, varPart, vars, _ref2, _ref3, _ref4, _ref5, _ref6;
scope = o.scope;
body = this.body;
name = !this.pattern && ((_ref2 = this.name) != null ? _ref2.compile(o) : void 0);
@ -1641,7 +1641,7 @@
Switch.prototype.children = ['subject', 'cases', 'otherwise'];
Switch.prototype.isStatement = YES;
Switch.prototype.makeReturn = function() {
var _i, _len, _ref2, _ref3, pair;
var pair, _i, _len, _ref2, _ref3;
_ref2 = this.cases;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
pair = _ref2[_i];
@ -1653,7 +1653,7 @@
return this;
};
Switch.prototype.compileNode = function(o) {
var _i, _j, _len, _len2, _ref2, _ref3, _ref4, _ref5, block, body, code, cond, conditions, expr, i, idt1, idt2;
var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _j, _len, _len2, _ref2, _ref3, _ref4, _ref5;
idt1 = this.idt(1);
idt2 = o.indent = this.idt(2);
code = this.tab + ("switch (" + (((_ref2 = this.subject) != null ? _ref2.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n");

View File

@ -10,7 +10,7 @@
return OptionParser;
})();
OptionParser.prototype.parse = function(args) {
var _i, _len, _len2, _ref, arg, i, isOption, matchedRule, options, rule, value;
var arg, i, isOption, matchedRule, options, rule, value, _i, _len, _len2, _ref;
options = {
arguments: []
};
@ -40,7 +40,7 @@
return options;
};
OptionParser.prototype.help = function() {
var _i, _len, _ref, letPart, lines, rule, spaces;
var letPart, lines, rule, spaces, _i, _len, _ref;
lines = ['Available options:'];
if (this.banner) {
lines.unshift("" + this.banner + "\n");
@ -62,7 +62,7 @@
MULTI_FLAG = /^-(\w{2,})/;
OPTIONAL = /\[(\w+(\*?))\]/;
buildRules = function(rules) {
var _i, _len, _result, tuple;
var tuple, _i, _len, _result;
_result = [];
for (_i = 0, _len = rules.length; _i < _len; _i++) {
tuple = rules[_i];
@ -88,7 +88,7 @@
};
};
normalizeArguments = function(args) {
var _i, _j, _len, _len2, _ref, arg, l, match, result;
var arg, l, match, result, _i, _j, _len, _len2, _ref;
args = args.slice(0);
result = [];
for (_i = 0, _len = args.length; _i < _len; _i++) {

View File

@ -1,5 +1,5 @@
(function() {
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, _i, _len, _ref, left, rite;
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref;
var __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
@ -37,7 +37,7 @@
return true;
};
exports.Rewriter.prototype.detectEnd = function(i, condition, action) {
var _ref, _ref2, levels, token, tokens;
var levels, token, tokens, _ref, _ref2;
tokens = this.tokens;
levels = 0;
while (token = tokens[i]) {
@ -58,7 +58,7 @@
};
exports.Rewriter.prototype.adjustComments = function() {
return this.scanTokens(function(token, i, tokens) {
var _ref, after, before, post, prev;
var after, before, post, prev, _ref;
if (token[0] !== 'HERECOMMENT') {
return 1;
}
@ -85,7 +85,7 @@
});
};
exports.Rewriter.prototype.removeLeadingNewlines = function() {
var _len, i, tag;
var i, tag, _len;
for (i = 0, _len = this.tokens.length; i < _len; i++) {
tag = this.tokens[i][0];
if (tag !== 'TERMINATOR') {
@ -141,7 +141,7 @@
stack = [];
start = null;
condition = function(token, i) {
var _ref, _ref2, one, tag, three, two;
var one, tag, three, two, _ref, _ref2;
if ('HERECOMMENT' === this.tag(i + 1) || 'HERECOMMENT' === this.tag(i - 1)) {
return false;
}
@ -153,7 +153,7 @@
return this.tokens.splice(i, 0, ['}', '}', token[2]]);
};
return this.scanTokens(function(token, i, tokens) {
var _ref, _ref2, ago1, ago2, idx, tag, tok;
var ago1, ago2, idx, tag, tok, _ref, _ref2;
if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) {
stack.push([(tag === 'INDENT' && this.tag(i - 1) === '{' ? '{' : tag), i]);
return 1;
@ -186,7 +186,7 @@
return this.tokens.splice(idx, 0, ['CALL_END', ')', token[2]]);
};
return this.scanTokens(function(token, i, tokens) {
var _ref, _ref2, callObject, next, prev, seenSingle, tag;
var callObject, next, prev, seenSingle, tag, _ref, _ref2;
tag = token[0];
if (tag === 'CLASS') {
classLine = true;
@ -205,7 +205,7 @@
}
tokens.splice(i, 0, ['CALL_START', '(', token[2]]);
this.detectEnd(i + (callObject ? 2 : 1), function(token, i) {
var _ref3, post;
var post, _ref3;
if (!seenSingle && token.fromThen) {
return true;
}
@ -226,7 +226,7 @@
};
exports.Rewriter.prototype.addImplicitIndentation = function() {
return this.scanTokens(function(token, i, tokens) {
var _ref, _ref2, action, condition, indent, outdent, starter, tag;
var action, condition, indent, outdent, starter, tag, _ref, _ref2;
tag = token[0];
if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') {
tokens.splice(i, 1);
@ -271,7 +271,7 @@
return (_ref = token[0]) === 'TERMINATOR' || _ref === 'INDENT';
};
return this.scanTokens(function(token, i) {
var _ref, original;
var original, _ref;
if ((_ref = token[0]) !== 'IF' && _ref !== 'UNLESS') {
return 1;
}
@ -283,11 +283,11 @@
});
};
exports.Rewriter.prototype.ensureBalance = function(pairs) {
var _result, key, levels, open, openLine, unclosed, value;
var key, levels, open, openLine, unclosed, value, _result;
levels = {};
openLine = {};
this.scanTokens(function(token, i) {
var _i, _len, _ref, close, open, tag;
var close, open, tag, _i, _len, _ref;
tag = token[0];
for (_i = 0, _len = pairs.length; _i < _len; _i++) {
_ref = pairs[_i], open = _ref[0], close = _ref[1];
@ -328,7 +328,7 @@
debt[key] = 0;
}
return this.scanTokens(function(token, i, tokens) {
var _ref, inv, match, mtag, oppos, tag, val;
var inv, match, mtag, oppos, tag, val, _ref;
if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) {
stack.push(token);
return 1;

View File

@ -1,5 +1,5 @@
(function() {
var Scope, _ref, extend, last;
var Scope, extend, last, _ref;
_ref = require('./helpers'), extend = _ref.extend, last = _ref.last;
exports.Scope = (function() {
Scope = (function() {
@ -37,7 +37,7 @@
return this;
};
Scope.prototype.endLevel = function() {
var _i, _len, _ref2, name;
var name, _i, _len, _ref2;
_ref2 = this.garbage.pop();
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
name = _ref2[_i];
@ -55,7 +55,7 @@
return false;
};
Scope.prototype.any = function(fn) {
var _i, _len, _ref2, v;
var v, _i, _len, _ref2;
_ref2 = this.variables;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
v = _ref2[_i];
@ -69,7 +69,7 @@
return this.add(name, 'param');
};
Scope.prototype.check = function(name, options) {
var _ref2, immediate;
var immediate, _ref2;
immediate = !!this.type(name);
if (immediate || (options != null ? options.immediate : void 0)) {
return immediate;
@ -80,7 +80,7 @@
return name.length > 1 ? '_' + name + (index > 1 ? index : '') : '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a');
};
Scope.prototype.type = function(name) {
var _i, _len, _ref2, v;
var v, _i, _len, _ref2;
_ref2 = this.variables;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
v = _ref2[_i];
@ -91,7 +91,7 @@
return null;
};
Scope.prototype.freeVariable = function(type) {
var _ref2, index, temp;
var index, temp, _ref2;
index = 0;
while (this.check(temp = this.temporary(type, index)) && this.type(temp) !== 'reuse') {
index++;
@ -120,21 +120,19 @@
});
};
Scope.prototype.declaredVariables = function() {
var _i, _len, _ref2, _ref3, _result, v;
return ((function() {
_ref2 = this.variables;
_result = [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
v = _ref2[_i];
if ((_ref3 = v.type) === 'var' || _ref3 === 'reuse') {
_result.push(v.name);
}
var name, tmp, type, usr, _i, _len, _ref2;
usr = [];
tmp = [];
for (_i = 0, _len = this.variables.length; _i < _len; _i++) {
_ref2 = this.variables[_i], name = _ref2.name, type = _ref2.type;
if (type === 'var' || type === 'reuse') {
(name.charAt(0) === '_' ? tmp : usr).push(name);
}
return _result;
}).call(this)).sort();
}
return usr.sort().concat(tmp.sort());
};
Scope.prototype.assignedVariables = function() {
var _i, _len, _ref2, _result, v;
var v, _i, _len, _ref2, _result;
_ref2 = this.variables;
_result = [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {

View File

@ -106,7 +106,11 @@ exports.Scope = class Scope
# Return the list of variables first declared in this scope.
declaredVariables: ->
(v.name for v in @variables when v.type in ['var', 'reuse']).sort()
usr = []
tmp = []
for {name, type} in @variables when type in ['var', 'reuse']
(if name.charAt(0) is '_' then tmp else usr).push name
usr.sort().concat tmp.sort()
# Return the list of assignments that are supposed to be made at the top
# of this scope.