diff --git a/lib/coffee-script.js b/lib/coffee-script.js index 309e8d14..be7e4ec0 100755 --- a/lib/coffee-script.js +++ b/lib/coffee-script.js @@ -66,8 +66,8 @@ lexer = new Lexer; parser.lexer = { lex: function() { - var tag, _ref; - _ref = this.tokens[this.pos++] || [''], tag = _ref[0], this.yytext = _ref[1], this.yylineno = _ref[2]; + var tag, _ref2; + _ref2 = this.tokens[this.pos++] || [''], tag = _ref2[0], this.yytext = _ref2[1], this.yylineno = _ref2[2]; return tag; }, setInput: function(tokens) { diff --git a/lib/command.js b/lib/command.js index 10a1477b..28cc0aea 100644 --- a/lib/command.js +++ b/lib/command.js @@ -66,13 +66,13 @@ return fs.stat(source, function(err, stats) { if (stats.isDirectory()) { return fs.readdir(source, function(err, files) { - var file, _i, _len, _results; - _results = []; - for (_i = 0, _len = files.length; _i < _len; _i++) { - file = files[_i]; - _results.push(compile(path.join(source, file))); + var file, _j, _len2, _results2; + _results2 = []; + for (_j = 0, _len2 = files.length; _j < _len2; _j++) { + file = files[_j]; + _results2.push(compile(path.join(source, file))); } - return _results; + return _results2; }); } else if (topLevel || path.extname(source) === '.coffee') { fs.readFile(source, function(err, code) { @@ -155,12 +155,12 @@ return compileScript("concatenation", code, "concatenation"); }; loadRequires = function() { - var realFilename, req, _i, _len, _ref; + var realFilename, req, _i, _len, _ref2; realFilename = module.filename; module.filename = '.'; - _ref = opts.require; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - req = _ref[_i]; + _ref2 = opts.require; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + req = _ref2[_i]; require(req); } return module.filename = realFilename; @@ -223,11 +223,11 @@ printTokens = function(tokens) { var strings, tag, token, value; strings = (function() { - var _i, _len, _ref, _results; + var _i, _len, _ref2, _results; _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]; + _ref2 = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref2[0], value = _ref2[1]; _results.push("[" + tag + " " + value + "]"); } return _results; diff --git a/lib/lexer.js b/lib/lexer.js index 8fdee451..581baa71 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -37,7 +37,7 @@ return (new Rewriter).rewrite(this.tokens); }; Lexer.prototype.identifierToken = function() { - var colon, forcedIdentifier, id, input, match, prev, tag, _ref, _ref2; + var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3; if (!(match = IDENTIFIER.exec(this.chunk))) { return 0; } @@ -46,11 +46,11 @@ this.token('OWN', id); return id.length; } - forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref = prev[0]) === '.' || _ref === '?.' || _ref === '::') || !prev.spaced && prev[0] === '@'); + forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::') || !prev.spaced && prev[0] === '@'); tag = 'IDENTIFIER'; if (__indexOf.call(JS_KEYWORDS, id) >= 0 || !forcedIdentifier && __indexOf.call(COFFEE_KEYWORDS, id) >= 0) { tag = id.toUpperCase(); - if (tag === 'WHEN' && (_ref2 = this.tag(), __indexOf.call(LINE_BREAK, _ref2) >= 0)) { + if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) { tag = 'LEADING_WHEN'; } else if (tag === 'FOR') { this.seenFor = true; @@ -194,7 +194,7 @@ return script.length; }; Lexer.prototype.regexToken = function() { - var match, prev, regex, _ref; + var match, prev, regex, _ref2; if (this.chunk.charAt(0) !== '/') { return 0; } @@ -202,7 +202,7 @@ return this.heregexToken(match); } prev = last(this.tokens); - if (prev && (_ref = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref) >= 0)) { + if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) { return 0; } if (!(match = REGEX.exec(this.chunk))) { @@ -213,7 +213,7 @@ return regex.length; }; Lexer.prototype.heregexToken = function(match) { - var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref, _ref2, _ref3, _ref4; + var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4, _ref5; heregex = match[0], body = match[1], flags = match[2]; if (0 > body.indexOf('#{')) { re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/'); @@ -223,11 +223,11 @@ this.token('IDENTIFIER', 'RegExp'); this.tokens.push(['CALL_START', '(']); tokens = []; - _ref = this.interpolateString(body, { + _ref2 = this.interpolateString(body, { regex: true }); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - _ref2 = _ref[_i], tag = _ref2[0], value = _ref2[1]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + _ref3 = _ref2[_i], tag = _ref3[0], value = _ref3[1]; if (tag === 'TOKENS') { tokens.push.apply(tokens, value); } else { @@ -240,10 +240,10 @@ tokens.push(['+', '+']); } tokens.pop(); - if (((_ref3 = tokens[0]) != null ? _ref3[0] : void 0) !== 'STRING') { + if (((_ref4 = tokens[0]) != null ? _ref4[0] : void 0) !== 'STRING') { this.tokens.push(['STRING', '""'], ['+', '+']); } - (_ref4 = this.tokens).push.apply(_ref4, tokens); + (_ref5 = this.tokens).push.apply(_ref5, tokens); if (flags) { this.tokens.push([',', ','], ['STRING', '"' + flags + '"']); } @@ -340,7 +340,7 @@ return this; }; Lexer.prototype.literalToken = function() { - var match, prev, tag, value, _ref, _ref2, _ref3, _ref4; + var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5; if (match = OPERATOR.exec(this.chunk)) { value = match[0]; if (CODE.test(value)) { @@ -352,10 +352,10 @@ tag = value; prev = last(this.tokens); if (value === '=' && prev) { - if (!prev[1].reserved && (_ref = prev[1], __indexOf.call(JS_FORBIDDEN, _ref) >= 0)) { + if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) { this.assignmentError(); } - if ((_ref2 = prev[1]) === '||' || _ref2 === '&&') { + if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') { prev[0] = 'COMPOUND_ASSIGN'; prev[1] += '='; return value.length; @@ -376,12 +376,12 @@ } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) { tag = 'LOGIC'; } else if (prev && !prev.spaced) { - if (value === '(' && (_ref3 = prev[0], __indexOf.call(CALLABLE, _ref3) >= 0)) { + if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) { if (prev[0] === '?') { prev[0] = 'FUNC_EXIST'; } tag = 'CALL_START'; - } else if (value === '[' && (_ref4 = prev[0], __indexOf.call(INDEXABLE, _ref4) >= 0)) { + } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) { tag = 'INDEX_START'; switch (prev[0]) { case '?': @@ -396,7 +396,7 @@ return value.length; }; Lexer.prototype.sanitizeHeredoc = function(doc, options) { - var attempt, herecomment, indent, match, _ref; + var attempt, herecomment, indent, match, _ref2; indent = options.indent, herecomment = options.herecomment; if (herecomment) { if (HEREDOC_ILLEGAL.test(doc)) { @@ -408,7 +408,7 @@ } else { while (match = HEREDOC_INDENT.exec(doc)) { attempt = match[1]; - if (indent === null || (0 < (_ref = attempt.length) && _ref < indent.length)) { + if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) { indent = attempt; } } @@ -457,9 +457,9 @@ throw SyntaxError("Reserved word \"" + (this.value()) + "\" on line " + (this.line + 1) + " can't be assigned"); }; Lexer.prototype.balancedString = function(str, end) { - var i, letter, prev, stack, _ref; + var i, letter, prev, stack, _ref2; stack = [end]; - for (i = 1, _ref = str.length; 1 <= _ref ? i < _ref : i > _ref; 1 <= _ref ? i++ : i--) { + for (i = 1, _ref2 = str.length; 1 <= _ref2 ? i < _ref2 : i > _ref2; 1 <= _ref2 ? i++ : i--) { switch (letter = str.charAt(i)) { case '\\': i++; @@ -484,7 +484,7 @@ throw new Error("missing " + (stack.pop()) + ", starting on line " + (this.line + 1)); }; Lexer.prototype.interpolateString = function(str, options) { - var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _len, _ref, _ref2, _ref3; + var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _len, _ref2, _ref3, _ref4; if (options == null) { options = {}; } @@ -510,7 +510,7 @@ rewrite: false }); nested.pop(); - if (((_ref = nested[0]) != null ? _ref[0] : void 0) === 'TERMINATOR') { + if (((_ref2 = nested[0]) != null ? _ref2[0] : void 0) === 'TERMINATOR') { nested.shift(); } if (len = nested.length) { @@ -540,12 +540,12 @@ this.token('(', '('); } for (i = 0, _len = tokens.length; i < _len; i++) { - _ref2 = tokens[i], tag = _ref2[0], value = _ref2[1]; + _ref3 = tokens[i], tag = _ref3[0], value = _ref3[1]; if (i) { this.token('+', '+'); } if (tag === 'TOKENS') { - (_ref3 = this.tokens).push.apply(_ref3, value); + (_ref4 = this.tokens).push.apply(_ref4, value); } else { this.token('STRING', this.makeString(value, '"', heredoc)); } diff --git a/lib/nodes.js b/lib/nodes.js index 2dbca7ad..dc535726 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -63,9 +63,9 @@ } }; Base.prototype.compileLoopReference = function(o, name) { - var src, tmp, _ref; + var src, tmp, _ref2; src = tmp = this.compile(o, LEVEL_LIST); - if (!((-Infinity < (_ref = +src) && _ref < Infinity) || IDENTIFIER.test(src) && o.scope.check(src, true))) { + if (!((-Infinity < (_ref2 = +src) && _ref2 < Infinity) || IDENTIFIER.test(src) && o.scope.check(src, true))) { src = "" + (tmp = o.scope.freeVariable(name)) + " = " + src; } return [src, tmp]; @@ -117,17 +117,17 @@ return tree; }; Base.prototype.eachChild = function(func) { - var attr, child, _i, _j, _len, _len2, _ref, _ref2; + var attr, child, _i, _j, _len, _len2, _ref2, _ref3; if (!this.children) { return this; } - _ref = this.children; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - attr = _ref[_i]; + _ref2 = this.children; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + attr = _ref2[_i]; if (this[attr]) { - _ref2 = flatten([this[attr]]); - for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { - child = _ref2[_j]; + _ref3 = flatten([this[attr]]); + for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { + child = _ref3[_j]; if (func(child) === false) { return this; } @@ -194,10 +194,10 @@ return !this.expressions.length; }; Block.prototype.isStatement = function(o) { - var exp, _i, _len, _ref; - _ref = this.expressions; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - exp = _ref[_i]; + var exp, _i, _len, _ref2; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + exp = _ref2[_i]; if (exp.isStatement(o)) { return true; } @@ -205,10 +205,10 @@ return false; }; Block.prototype.jumps = function(o) { - var exp, _i, _len, _ref; - _ref = this.expressions; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - exp = _ref[_i]; + var exp, _i, _len, _ref2; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + exp = _ref2[_i]; if (exp.jumps(o)) { return exp; } @@ -240,13 +240,13 @@ } }; Block.prototype.compileNode = function(o) { - var code, codes, node, top, _i, _len, _ref; + var code, codes, node, top, _i, _len, _ref2; this.tab = o.indent; top = o.level === LEVEL_TOP; codes = []; - _ref = this.expressions; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + node = _ref2[_i]; node = node.unwrapAll(); node = node.unfoldSoak(o) || node; if (top) { @@ -280,11 +280,11 @@ } }; Block.prototype.compileWithDeclarations = function(o) { - var code, exp, i, post, rest, scope, _len, _ref; + var code, exp, i, post, rest, scope, _len, _ref2; code = post = ''; - _ref = this.expressions; - for (i = 0, _len = _ref.length; i < _len; i++) { - exp = _ref[i]; + _ref2 = this.expressions; + for (i = 0, _len = _ref2.length; i < _len; i++) { + exp = _ref2[i]; exp = exp.unwrap(); if (!(exp instanceof Comment || exp instanceof Literal)) { break; @@ -334,8 +334,8 @@ return IDENTIFIER.test(this.value); }; Literal.prototype.isStatement = function() { - var _ref; - return (_ref = this.value) === 'break' || _ref === 'continue' || _ref === 'debugger'; + var _ref2; + return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger'; }; Literal.prototype.isComplex = NO; Literal.prototype.assigns = function(name) { @@ -377,8 +377,8 @@ Return.prototype.makeReturn = THIS; Return.prototype.jumps = THIS; Return.prototype.compile = function(o, level) { - var expr, _ref; - expr = (_ref = this.expression) != null ? _ref.makeReturn() : void 0; + var expr, _ref2; + expr = (_ref2 = this.expression) != null ? _ref2.makeReturn() : void 0; if (expr && !(expr instanceof Return)) { return expr.compile(o, level); } else { @@ -424,10 +424,10 @@ return this.base instanceof Literal && SIMPLENUM.test(this.base.value); }; Value.prototype.isAtomic = function() { - var node, _i, _len, _ref; - _ref = this.properties.concat(this.base); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; + var node, _i, _len, _ref2; + _ref2 = this.properties.concat(this.base); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + node = _ref2[_i]; if (node.soak || node instanceof Call) { return false; } @@ -502,14 +502,14 @@ return code; }; Value.prototype.unfoldSoak = function(o) { - var fst, i, ifn, prop, ref, snd, _len, _ref; + 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; } - _ref = this.properties; - for (i = 0, _len = _ref.length; i < _len; i++) { - prop = _ref[i]; + _ref2 = this.properties; + for (i = 0, _len = _ref2.length; i < _len; i++) { + prop = _ref2[i]; if (prop.soak) { prop.soak = false; fst = new Value(this.base, this.properties.slice(0, i)); @@ -582,13 +582,13 @@ } }; Call.prototype.unfoldSoak = function(o) { - var call, ifn, left, list, rite, _i, _len, _ref, _ref2; + var call, ifn, left, list, rite, _i, _len, _ref2, _ref3; if (this.soak) { if (this.variable) { if (ifn = unfoldSoak(o, this, 'variable')) { return ifn; } - _ref = new Value(this.variable).cacheReference(o), left = _ref[0], rite = _ref[1]; + _ref2 = new Value(this.variable).cacheReference(o), left = _ref2[0], rite = _ref2[1]; } else { left = new Literal(this.superReference(o)); rite = new Value(left); @@ -616,9 +616,9 @@ break; } } - _ref2 = list.reverse(); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - call = _ref2[_i]; + _ref3 = list.reverse(); + for (_i = 0, _len = _ref3.length; _i < _len; _i++) { + call = _ref3[_i]; if (ifn) { if (call.variable instanceof Call) { call.variable = ifn; @@ -631,7 +631,7 @@ return ifn; }; Call.prototype.filterImplicitObjects = function(list) { - var node, nodes, obj, prop, properties, _i, _j, _len, _len2, _ref; + var node, nodes, obj, prop, properties, _i, _j, _len, _len2, _ref2; nodes = []; for (_i = 0, _len = list.length; _i < _len; _i++) { node = list[_i]; @@ -640,9 +640,9 @@ continue; } obj = null; - _ref = node.base.properties; - for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { - prop = _ref[_j]; + _ref2 = node.base.properties; + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + prop = _ref2[_j]; if (prop instanceof Assign) { if (!obj) { nodes.push(obj = new Obj(properties = [], true)); @@ -657,9 +657,9 @@ return nodes; }; Call.prototype.compileNode = function(o) { - var arg, args, code, _ref; - if ((_ref = this.variable) != null) { - _ref.front = this.front; + var arg, args, code, _ref2; + if ((_ref2 = this.variable) != null) { + _ref2.front = this.front; } if (code = Splat.compileSplattedArray(o, this.args, true)) { return this.compileSplat(o, code); @@ -766,13 +766,13 @@ this.equals = this.exclusive ? '' : '='; } Range.prototype.compileVariables = function(o) { - var parts, _ref, _ref2, _ref3; + var parts, _ref2, _ref3, _ref4; o = merge(o, { top: true }); - _ref = this.from.cache(o, LEVEL_LIST), this.from = _ref[0], this.fromVar = _ref[1]; - _ref2 = this.to.cache(o, LEVEL_LIST), this.to = _ref2[0], this.toVar = _ref2[1]; - _ref3 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref3[0], this.toNum = _ref3[1]; + _ref2 = this.from.cache(o, LEVEL_LIST), this.from = _ref2[0], this.fromVar = _ref2[1]; + _ref3 = this.to.cache(o, LEVEL_LIST), this.to = _ref3[0], this.toVar = _ref3[1]; + _ref4 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref4[0], this.toNum = _ref4[1]; parts = []; if (this.from !== this.fromVar) { parts.push(this.from); @@ -799,8 +799,8 @@ return "" + vars + "; " + compare + "; " + incr; }; Range.prototype.compileSimple = function(o) { - var from, idx, step, to, _ref; - _ref = [+this.fromNum, +this.toNum], from = _ref[0], to = _ref[1]; + var from, idx, step, to, _ref2; + _ref2 = [+this.fromNum, +this.toNum], from = _ref2[0], to = _ref2[1]; idx = del(o, 'index'); step = del(o, 'step'); step && (step = "" + idx + " += " + (step.compile(o))); @@ -811,11 +811,11 @@ } }; Range.prototype.compileArray = function(o) { - var body, clause, i, idt, post, pre, range, result, vars, _i, _ref, _ref2, _results; + var body, cond, i, idt, post, pre, range, result, vars, _i, _ref2, _ref3, _results; if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) { range = (function() { _results = []; - for (var _i = _ref = +this.fromNum, _ref2 = +this.toNum; _ref <= _ref2 ? _i <= _ref2 : _i >= _ref2; _ref <= _ref2 ? _i++ : _i--){ _results.push(_i); } + for (var _i = _ref2 = +this.fromNum, _ref3 = +this.toNum; _ref2 <= _ref3 ? _i <= _ref3 : _i >= _ref3; _ref2 <= _ref3 ? _i++ : _i--){ _results.push(_i); } return _results; }).apply(this, arguments); if (this.exclusive) { @@ -832,8 +832,8 @@ body = this.compileSimple(o); } else { vars = ("" + i + " = " + this.from) + (this.to !== this.toVar ? ", " + this.to : ''); - clause = "" + this.fromVar + " <= " + this.toVar + " ?"; - body = "var " + vars + "; " + clause + " " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + clause + " " + i + "++ : " + i + "--"; + cond = "" + this.fromVar + " <= " + this.toVar; + body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--"; } post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent; return "(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this, arguments)"; @@ -848,8 +848,8 @@ Slice.__super__.constructor.call(this); } Slice.prototype.compileNode = function(o) { - var compiled, from, fromStr, to, toStr, _ref; - _ref = this.range, to = _ref.to, from = _ref.from; + var compiled, from, fromStr, to, toStr, _ref2; + _ref2 = this.range, to = _ref2.to, from = _ref2.from; fromStr = from && from.compile(o, LEVEL_PAREN) || '0'; compiled = to && to.compile(o, LEVEL_PAREN); if (to && !(!this.range.exclusive && +compiled === -1)) { @@ -887,9 +887,9 @@ idt = o.indent += TAB; lastNoncom = this.lastNonComment(this.properties); props = (function() { - var _len, _results; + var _len2, _results; _results = []; - for (i = 0, _len = props.length; i < _len; i++) { + for (i = 0, _len2 = props.length; i < _len2; i++) { prop = props[i]; join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; indent = prop instanceof Comment ? '' : idt; @@ -915,10 +915,10 @@ } }; Obj.prototype.assigns = function(name) { - var prop, _i, _len, _ref; - _ref = this.properties; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - prop = _ref[_i]; + var prop, _i, _len, _ref2; + _ref2 = this.properties; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + prop = _ref2[_i]; if (prop.assigns(name)) { return true; } @@ -960,10 +960,10 @@ } }; Arr.prototype.assigns = function(name) { - var obj, _i, _len, _ref; - _ref = this.objects; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - obj = _ref[_i]; + var obj, _i, _len, _ref2; + _ref2 = this.objects; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + obj = _ref2[_i]; if (obj.assigns(name)) { return true; } @@ -1006,12 +1006,12 @@ }); }; Class.prototype.addBoundFunctions = function(o) { - var bname, bvar, _i, _len, _ref, _results; + var bname, bvar, _i, _len, _ref2, _results; if (this.boundFuncs.length) { - _ref = this.boundFuncs; + _ref2 = this.boundFuncs; _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - bvar = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + bvar = _ref2[_i]; bname = bvar.compile(o); _results.push(this.ctor.body.unshift(new Literal("this." + bname + " = " + (utility('bind')) + "(this." + bname + ", this);"))); } @@ -1055,14 +1055,14 @@ }; Class.prototype.walkBody = function(name) { return this.traverseChildren(false, __bind(function(child) { - var exps, i, node, _len, _ref; + var exps, i, node, _len, _ref2; if (child instanceof Class) { return false; } if (child instanceof Block) { - _ref = exps = child.expressions; - for (i = 0, _len = _ref.length; i < _len; i++) { - node = _ref[i]; + _ref2 = exps = child.expressions; + for (i = 0, _len = _ref2.length; i < _len; i++) { + node = _ref2[i]; if (node instanceof Value && node.isObject(true)) { exps[i] = this.addProperties(node, name); } @@ -1121,7 +1121,7 @@ return unfoldSoak(o, this, 'variable'); }; Assign.prototype.compileNode = function(o) { - var isValue, match, name, val, _ref; + var isValue, match, name, val, _ref2; if (isValue = this.variable instanceof Value) { if (this.variable.isArray() || this.variable.isObject()) { return this.compilePatternMatch(o); @@ -1129,7 +1129,7 @@ if (this.variable.isSplice()) { return this.compileSplice(o); } - if ((_ref = this.context) === '||=' || _ref === '&&=' || _ref === '?=') { + if ((_ref2 = this.context) === '||=' || _ref2 === '&&=' || _ref2 === '?=') { return this.compileConditional(o); } } @@ -1162,7 +1162,7 @@ } }; Assign.prototype.compilePatternMatch = function(o) { - var acc, assigns, code, i, idx, isObject, ivar, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _len, _ref, _ref2, _ref3, _ref4; + var acc, assigns, code, i, idx, isObject, ivar, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _len, _ref2, _ref3, _ref4, _ref5; top = o.level === LEVEL_TOP; value = this.value; objects = this.variable.base.objects; @@ -1180,10 +1180,10 @@ isObject = this.variable.isObject(); if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) { if (obj instanceof Assign) { - _ref = obj, idx = _ref.variable.base, obj = _ref.value; + _ref2 = obj, idx = _ref2.variable.base, obj = _ref2.value; } else { if (obj.base instanceof Parens) { - _ref2 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref2[0], idx = _ref2[1]; + _ref3 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref3[0], idx = _ref3[1]; } else { idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0); } @@ -1205,10 +1205,10 @@ idx = i; if (isObject) { if (obj instanceof Assign) { - _ref3 = obj, idx = _ref3.variable.base, obj = _ref3.value; + _ref4 = obj, idx = _ref4.variable.base, obj = _ref4.value; } else { if (obj.base instanceof Parens) { - _ref4 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref4[0], idx = _ref4[1]; + _ref5 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref5[0], idx = _ref5[1]; } else { idx = obj["this"] ? obj.properties[0].name : obj; } @@ -1252,15 +1252,15 @@ } }; Assign.prototype.compileConditional = function(o) { - var left, rite, _ref; - _ref = this.variable.cacheReference(o), left = _ref[0], rite = _ref[1]; + 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); }; Assign.prototype.compileSplice = function(o) { - var code, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref, _ref2, _ref3; - _ref = this.variable.properties.pop().range, from = _ref.from, to = _ref.to, exclusive = _ref.exclusive; + var code, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref2, _ref3, _ref4; + _ref2 = this.variable.properties.pop().range, from = _ref2.from, to = _ref2.to, exclusive = _ref2.exclusive; name = this.variable.compile(o); - _ref2 = (from != null ? from.cache(o, LEVEL_OP) : void 0) || ['0', '0'], fromDecl = _ref2[0], fromRef = _ref2[1]; + _ref3 = (from != null ? from.cache(o, LEVEL_OP) : void 0) || ['0', '0'], fromDecl = _ref3[0], fromRef = _ref3[1]; if (to) { if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) { to = +to.compile(o) - +fromRef; @@ -1276,7 +1276,7 @@ } else { to = "9e9"; } - _ref3 = this.value.cache(o, LEVEL_LIST), valDef = _ref3[0], valRef = _ref3[1]; + _ref4 = this.value.cache(o, LEVEL_LIST), valDef = _ref4[0], valRef = _ref4[1]; code = "[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat(" + valDef + ")), " + valRef; if (o.level > LEVEL_TOP) { return "(" + code + ")"; @@ -1302,7 +1302,7 @@ }; Code.prototype.jumps = NO; Code.prototype.compileNode = function(o) { - var code, exprs, i, idt, lit, p, param, ref, splats, v, val, vars, wasEmpty, _i, _j, _len, _len2, _len3, _ref, _ref2, _ref3; + var code, exprs, i, idt, lit, p, param, ref, splats, v, val, vars, wasEmpty, _i, _j, _len, _len2, _len3, _ref2, _ref3, _ref4; o.scope = new Scope(o.scope, this.body, this); o.scope.shared = del(o, 'sharedScope'); o.indent += TAB; @@ -1310,19 +1310,19 @@ delete o.globals; vars = []; exprs = []; - _ref = this.params; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - param = _ref[_i]; + _ref2 = this.params; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + param = _ref2[_i]; if (param.splat) { if (param.name.value) { o.scope.add(param.name.value, 'var'); } splats = new Assign(new Value(new Arr((function() { - var _i, _len, _ref, _results; - _ref = this.params; + var _j, _len2, _ref3, _results; + _ref3 = this.params; _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - p = _ref[_i]; + for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { + p = _ref3[_j]; _results.push(p.asReference(o)); } return _results; @@ -1330,9 +1330,9 @@ break; } } - _ref2 = this.params; - for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { - param = _ref2[_j]; + _ref3 = this.params; + for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { + param = _ref3[_j]; if (param.isComplex()) { val = ref = param.asReference(o); if (param.value) { @@ -1358,7 +1358,7 @@ exprs.unshift(splats); } if (exprs.length) { - (_ref3 = this.body.expressions).unshift.apply(_ref3, exprs); + (_ref4 = this.body.expressions).unshift.apply(_ref4, exprs); } if (!splats) { for (i = 0, _len3 = vars.length; i < _len3; i++) { @@ -1477,11 +1477,11 @@ return args[0] + (".concat(" + (args.slice(1).join(', ')) + ")"); } base = (function() { - var _i, _len, _ref, _results; - _ref = list.slice(0, index); + var _i, _len2, _ref2, _results; + _ref2 = list.slice(0, index); _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; + for (_i = 0, _len2 = _ref2.length; _i < _len2; _i++) { + node = _ref2[_i]; _results.push(node.compile(o, LEVEL_LIST)); } return _results; @@ -1592,11 +1592,11 @@ return !this.second; }; Op.prototype.isChainable = function() { - var _ref; - return (_ref = this.operator) === '<' || _ref === '>' || _ref === '>=' || _ref === '<=' || _ref === '===' || _ref === '!=='; + var _ref2; + return (_ref2 = this.operator) === '<' || _ref2 === '>' || _ref2 === '>=' || _ref2 === '<=' || _ref2 === '===' || _ref2 === '!=='; }; Op.prototype.invert = function() { - var allInvertable, curr, fst, op, _ref; + var allInvertable, curr, fst, op, _ref2; if (this.isChainable() && this.first.isChainable()) { allInvertable = true; curr = this; @@ -1622,15 +1622,15 @@ return this; } else if (this.second) { return new Parens(this).invert(); - } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref = fst.operator) === '!' || _ref === 'in' || _ref === 'instanceof')) { + } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref2 = fst.operator) === '!' || _ref2 === 'in' || _ref2 === 'instanceof')) { return fst; } else { return new Op('!', this); } }; Op.prototype.unfoldSoak = function(o) { - var _ref; - return ((_ref = this.operator) === '++' || _ref === '--' || _ref === 'delete') && unfoldSoak(o, this, 'first'); + var _ref2; + return ((_ref2 = this.operator) === '++' || _ref2 === '--' || _ref2 === 'delete') && unfoldSoak(o, this, 'first'); }; Op.prototype.compileNode = function(o) { var code; @@ -1652,8 +1652,8 @@ } }; Op.prototype.compileChain = function(o) { - var code, fst, shared, _ref; - _ref = this.first.second.cache(o), this.first.second = _ref[0], shared = _ref[1]; + 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); code = "" + fst + " " + (this.invert ? '&&' : '||') + " " + (shared.compile(o)) + " " + this.operator + " " + (this.second.compile(o, LEVEL_OP)); return "(" + code + ")"; @@ -1707,15 +1707,15 @@ } }; In.prototype.compileOrTest = function(o) { - var cmp, cnj, i, item, ref, sub, tests, _ref, _ref2; - _ref = this.object.cache(o, LEVEL_OP), sub = _ref[0], ref = _ref[1]; - _ref2 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref2[0], cnj = _ref2[1]; + var cmp, cnj, i, item, ref, sub, tests, _ref2, _ref3; + _ref2 = this.object.cache(o, LEVEL_OP), sub = _ref2[0], ref = _ref2[1]; + _ref3 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref3[0], cnj = _ref3[1]; tests = (function() { - var _len, _ref, _results; - _ref = this.array.base.objects; + var _len, _ref4, _results; + _ref4 = this.array.base.objects; _results = []; - for (i = 0, _len = _ref.length; i < _len; i++) { - item = _ref[i]; + for (i = 0, _len = _ref4.length; i < _len; i++) { + item = _ref4[i]; _results.push((i ? ref : sub) + cmp + item.compile(o, LEVEL_OP)); } return _results; @@ -1731,8 +1731,8 @@ } }; In.prototype.compileLoopTest = function(o) { - var code, ref, sub, _ref; - _ref = this.object.cache(o, LEVEL_LIST), sub = _ref[0], ref = _ref[1]; + 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, LEVEL_LIST)) + ", " + ref + ") ") + (this.negated ? '< 0' : '>= 0'); if (sub === ref) { return code; @@ -1760,8 +1760,8 @@ Try.prototype.children = ['attempt', 'recovery', 'ensure']; Try.prototype.isStatement = YES; Try.prototype.jumps = function(o) { - var _ref; - return this.attempt.jumps(o) || ((_ref = this.recovery) != null ? _ref.jumps(o) : void 0); + var _ref2; + return this.attempt.jumps(o) || ((_ref2 = this.recovery) != null ? _ref2.jumps(o) : void 0); }; Try.prototype.makeReturn = function() { if (this.attempt) { @@ -1849,13 +1849,13 @@ exports.For = For = (function() { __extends(For, Base); function For(body, source) { - var _ref; + var _ref2; this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index; this.body = Block.wrap([body]); this.own = !!source.own; this.object = !!source.object; if (this.object) { - _ref = [this.index, this.name], this.name = _ref[0], this.index = _ref[1]; + _ref2 = [this.index, this.name], this.name = _ref2[0], this.index = _ref2[1]; } if (this.index instanceof Value) { throw SyntaxError('index cannot be a pattern matching expression'); @@ -1878,9 +1878,9 @@ return this; }; For.prototype.compileNode = function(o) { - var body, defPart, forPart, guardPart, idt1, index, ivar, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, svar, varPart, _ref; + var body, defPart, forPart, guardPart, idt1, index, ivar, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, svar, varPart, _ref2; body = Block.wrap([this.body]); - lastJumps = (_ref = last(body.expressions)) != null ? _ref.jumps() : void 0; + lastJumps = (_ref2 = last(body.expressions)) != null ? _ref2.jumps() : void 0; if (lastJumps && lastJumps instanceof Return) { this.returns = false; } @@ -1959,24 +1959,24 @@ return "" + defPart + (resultPart || '') + this.tab + "for (" + forPart + ") {" + guardPart + varPart + body + this.tab + "}" + (returnResult || ''); }; For.prototype.pluckDirectCall = function(o, body) { - var base, defs, expr, fn, idx, ref, val, _len, _ref, _ref2, _ref3, _ref4, _ref5, _ref6; + var base, defs, expr, fn, idx, ref, val, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; defs = ''; - _ref = body.expressions; - for (idx = 0, _len = _ref.length; idx < _len; idx++) { - expr = _ref[idx]; + _ref2 = body.expressions; + for (idx = 0, _len = _ref2.length; idx < _len; idx++) { + expr = _ref2[idx]; expr = expr.unwrapAll(); if (!(expr instanceof Call)) { continue; } val = expr.variable.unwrapAll(); - if (!((val instanceof Code) || (val instanceof Value && ((_ref2 = val.base) != null ? _ref2.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref3 = (_ref4 = val.properties[0].name) != null ? _ref4.value : void 0) === 'call' || _ref3 === 'apply')))) { + if (!((val instanceof Code) || (val instanceof Value && ((_ref3 = val.base) != null ? _ref3.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref4 = (_ref5 = val.properties[0].name) != null ? _ref5.value : void 0) === 'call' || _ref4 === 'apply')))) { continue; } - fn = ((_ref5 = val.base) != null ? _ref5.unwrapAll() : void 0) || val; + fn = ((_ref6 = val.base) != null ? _ref6.unwrapAll() : void 0) || val; ref = new Literal(o.scope.freeVariable('fn')); base = new Value(ref); if (val.base) { - _ref6 = [base, val], val.base = _ref6[0], base = _ref6[1]; + _ref7 = [base, val], val.base = _ref7[0], base = _ref7[1]; args.unshift(new Literal('this')); } body.expressions[idx] = new Call(base, expr.args); @@ -1996,44 +1996,44 @@ Switch.prototype.children = ['subject', 'cases', 'otherwise']; Switch.prototype.isStatement = YES; Switch.prototype.jumps = function(o) { - var block, conds, _i, _len, _ref, _ref2, _ref3; + var block, conds, _i, _len, _ref2, _ref3, _ref4; if (o == null) { o = { block: true }; } - _ref = this.cases; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - _ref2 = _ref[_i], conds = _ref2[0], block = _ref2[1]; + _ref2 = this.cases; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + _ref3 = _ref2[_i], conds = _ref3[0], block = _ref3[1]; if (block.jumps(o)) { return block; } } - return (_ref3 = this.otherwise) != null ? _ref3.jumps(o) : void 0; + return (_ref4 = this.otherwise) != null ? _ref4.jumps(o) : void 0; }; Switch.prototype.makeReturn = function() { - var pair, _i, _len, _ref, _ref2; - _ref = this.cases; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - pair = _ref[_i]; + var pair, _i, _len, _ref2, _ref3; + _ref2 = this.cases; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + pair = _ref2[_i]; pair[1].makeReturn(); } - if ((_ref2 = this.otherwise) != null) { - _ref2.makeReturn(); + if ((_ref3 = this.otherwise) != null) { + _ref3.makeReturn(); } return this; }; Switch.prototype.compileNode = function(o) { - var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _len, _len2, _ref, _ref2, _ref3, _ref4; + var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _len, _len2, _ref2, _ref3, _ref4, _ref5; idt1 = o.indent + TAB; idt2 = o.indent = idt1 + TAB; - code = this.tab + ("switch (" + (((_ref = this.subject) != null ? _ref.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n"); - _ref2 = this.cases; - for (i = 0, _len = _ref2.length; i < _len; i++) { - _ref3 = _ref2[i], conditions = _ref3[0], block = _ref3[1]; - _ref4 = flatten([conditions]); - for (_i = 0, _len2 = _ref4.length; _i < _len2; _i++) { - cond = _ref4[_i]; + code = this.tab + ("switch (" + (((_ref2 = this.subject) != null ? _ref2.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n"); + _ref3 = this.cases; + for (i = 0, _len = _ref3.length; i < _len; i++) { + _ref4 = _ref3[i], conditions = _ref4[0], block = _ref4[1]; + _ref5 = flatten([conditions]); + for (_i = 0, _len2 = _ref5.length; _i < _len2; _i++) { + cond = _ref5[_i]; if (!this.subject) { cond = cond.invert(); } @@ -2072,12 +2072,12 @@ } If.prototype.children = ['condition', 'body', 'elseBody']; If.prototype.bodyNode = function() { - var _ref; - return (_ref = this.body) != null ? _ref.unwrap() : void 0; + var _ref2; + return (_ref2 = this.body) != null ? _ref2.unwrap() : void 0; }; If.prototype.elseBodyNode = function() { - var _ref; - return (_ref = this.elseBody) != null ? _ref.unwrap() : void 0; + var _ref2; + return (_ref2 = this.elseBody) != null ? _ref2.unwrap() : void 0; }; If.prototype.addElse = function(elseBody) { if (this.isChain) { @@ -2089,12 +2089,12 @@ return this; }; If.prototype.isStatement = function(o) { - var _ref; - return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref = this.elseBodyNode()) != null ? _ref.isStatement(o) : void 0); + var _ref2; + return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref2 = this.elseBodyNode()) != null ? _ref2.isStatement(o) : void 0); }; If.prototype.jumps = function(o) { - var _ref; - return this.body.jumps(o) || ((_ref = this.elseBody) != null ? _ref.jumps(o) : void 0); + var _ref2; + return this.body.jumps(o) || ((_ref2 = this.elseBody) != null ? _ref2.jumps(o) : void 0); }; If.prototype.compileNode = function(o) { if (this.isStatement(o)) { diff --git a/lib/rewriter.js b/lib/rewriter.js index 31c36e42..f2aa06f2 100644 --- a/lib/rewriter.js +++ b/lib/rewriter.js @@ -178,7 +178,7 @@ } tokens.splice(i, 0, ['CALL_START', '(', token[2]]); this.detectEnd(i + 1, function(token, i) { - var post, _ref; + var post, _ref4; tag = token[0]; if (!seenSingle && token.fromThen) { return true; @@ -189,7 +189,7 @@ if ((tag === '.' || tag === '?.' || tag === '::') && this.tag(i - 1) === 'OUTDENT') { return true; } - return !token.generated && this.tag(i - 1) !== ',' && __indexOf.call(IMPLICIT_END, tag) >= 0 && (tag !== 'INDENT' || (this.tag(i - 2) !== 'CLASS' && (_ref = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{'))); + return !token.generated && this.tag(i - 1) !== ',' && __indexOf.call(IMPLICIT_END, tag) >= 0 && (tag !== 'INDENT' || (this.tag(i - 2) !== 'CLASS' && (_ref4 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref4) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{'))); }, action); if (prev[0] === '?') { prev[0] = 'FUNC_EXIST'; @@ -222,8 +222,8 @@ indent.generated = outdent.generated = true; tokens.splice(i + 1, 0, indent); condition = function(token, i) { - var _ref; - return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN')); + var _ref3; + return token[1] !== ';' && (_ref3 = token[0], __indexOf.call(SINGLE_CLOSERS, _ref3) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN')); }; action = function(token, i) { return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); diff --git a/lib/scope.js b/lib/scope.js index 69bc6c59..ab88ba9f 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -46,12 +46,12 @@ return this.add(name, 'param'); }; Scope.prototype.check = function(name, immediate) { - var found, _ref; + var found, _ref2; found = !!this.type(name); if (found || immediate) { return found; } - return !!((_ref = this.parent) != null ? _ref.check(name) : void 0); + return !!((_ref2 = this.parent) != null ? _ref2.check(name) : void 0); }; Scope.prototype.temporary = function(name, index) { if (name.length > 1) { @@ -61,10 +61,10 @@ } }; Scope.prototype.type = function(name) { - var v, _i, _len, _ref; - _ref = this.variables; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - v = _ref[_i]; + var v, _i, _len, _ref2; + _ref2 = this.variables; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + v = _ref2[_i]; if (v.name === name) { return v.type; } @@ -74,7 +74,7 @@ Scope.prototype.freeVariable = function(type) { var index, temp; index = 0; - while (this.check((temp = this.temporary(type, index)), true)) { + while (this.check((temp = this.temporary(type, index)))) { index++; } this.add(temp, 'var', true); @@ -91,12 +91,12 @@ return !!this.declaredVariables().length; }; Scope.prototype.declaredVariables = function() { - var realVars, tempVars, v, _i, _len, _ref; + var realVars, tempVars, v, _i, _len, _ref2; realVars = []; tempVars = []; - _ref = this.variables; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - v = _ref[_i]; + _ref2 = this.variables; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + v = _ref2[_i]; if (v.type === 'var') { (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); } @@ -104,11 +104,11 @@ return realVars.sort().concat(tempVars.sort()); }; Scope.prototype.assignedVariables = function() { - var v, _i, _len, _ref, _results; - _ref = this.variables; + var v, _i, _len, _ref2, _results; + _ref2 = this.variables; _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - v = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + v = _ref2[_i]; if (v.type.assigned) { _results.push("" + v.name + " = " + v.type.value); } diff --git a/src/scope.coffee b/src/scope.coffee index 620fbcb4..76ceb775 100644 --- a/src/scope.coffee +++ b/src/scope.coffee @@ -66,7 +66,7 @@ exports.Scope = class Scope # compiler-generated variable. `_var`, `_var2`, and so on... freeVariable: (type) -> index = 0 - index++ while @check((temp = @temporary type, index), true) + index++ while @check((temp = @temporary type, index)) @add temp, 'var', yes temp