diff --git a/lib/coffee-script/coffee-script.js b/lib/coffee-script/coffee-script.js index fd676ba4..9e3aabfb 100644 --- a/lib/coffee-script/coffee-script.js +++ b/lib/coffee-script/coffee-script.js @@ -77,7 +77,7 @@ }; exports["eval"] = function(code, options) { - var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref2, _ref3, _require; + var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref1, _ref2, _require; if (options == null) options = {}; if (!(code = code.trim())) return; Script = vm.Script; @@ -87,10 +87,10 @@ sandbox = options.sandbox; } else { sandbox = Script.createContext(); - _ref2 = options.sandbox; - for (k in _ref2) { - if (!__hasProp.call(_ref2, k)) continue; - v = _ref2[k]; + _ref1 = options.sandbox; + for (k in _ref1) { + if (!__hasProp.call(_ref1, k)) continue; + v = _ref1[k]; sandbox[k] = v; } } @@ -107,9 +107,9 @@ return Module._load(path, _module, true); }; _module.filename = sandbox.__filename; - _ref3 = Object.getOwnPropertyNames(require); - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - r = _ref3[_i]; + _ref2 = Object.getOwnPropertyNames(require); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + r = _ref2[_i]; if (r !== 'paths') _require[r] = require[r]; } _require.paths = _module.paths = Module._nodeModulePaths(process.cwd()); @@ -137,8 +137,8 @@ parser.lexer = { lex: function() { - var tag, _ref2; - _ref2 = this.tokens[this.pos++] || [''], tag = _ref2[0], this.yytext = _ref2[1], this.yylineno = _ref2[2]; + var tag, _ref1; + _ref1 = this.tokens[this.pos++] || [''], tag = _ref1[0], this.yytext = _ref1[1], this.yylineno = _ref1[2]; return tag; }, setInput: function(tokens) { diff --git a/lib/coffee-script/command.js b/lib/coffee-script/command.js index 195daa80..901e9ac6 100644 --- a/lib/coffee-script/command.js +++ b/lib/coffee-script/command.js @@ -89,11 +89,11 @@ if (stats.isDirectory()) { if (opts.watch) watchDir(source, base); return fs.readdir(source, function(err, files) { - var file, index, _i, _len, _ref2, _ref3, _results; + var file, index, _i, _len, _ref1, _ref2, _results; if (err && err.code !== 'ENOENT') throw err; if ((err != null ? err.code : void 0) === 'ENOENT') return; index = sources.indexOf(source); - [].splice.apply(sources, [index, index - index + 1].concat(_ref2 = (function() { + [].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() { var _i, _len, _results; _results = []; for (_i = 0, _len = files.length; _i < _len; _i++) { @@ -101,10 +101,10 @@ _results.push(path.join(source, file)); } return _results; - })())), _ref2; - [].splice.apply(sourceCode, [index, index - index + 1].concat(_ref3 = files.map(function() { + })())), _ref1; + [].splice.apply(sourceCode, [index, index - index + 1].concat(_ref2 = files.map(function() { return null; - }))), _ref3; + }))), _ref2; _results = []; for (_i = 0, _len = files.length; _i < _len; _i++) { file = files[_i]; @@ -195,12 +195,12 @@ }; loadRequires = function() { - var realFilename, req, _i, _len, _ref2; + var realFilename, req, _i, _len, _ref1; realFilename = module.filename; module.filename = '.'; - _ref2 = opts.require; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - req = _ref2[_i]; + _ref1 = opts.require; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + req = _ref1[_i]; require(req); } return module.filename = realFilename; @@ -387,11 +387,11 @@ printTokens = function(tokens) { var strings, tag, token, value; strings = (function() { - var _i, _len, _ref2, _results; + var _i, _len, _ref1, _results; _results = []; for (_i = 0, _len = tokens.length; _i < _len; _i++) { token = tokens[_i]; - _ref2 = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref2[0], value = _ref2[1]; + _ref1 = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref1[0], value = _ref1[1]; _results.push("[" + tag + " " + value + "]"); } return _results; diff --git a/lib/coffee-script/grammar.js b/lib/coffee-script/grammar.js index 15c58783..053e1462 100644 --- a/lib/coffee-script/grammar.js +++ b/lib/coffee-script/grammar.js @@ -569,12 +569,12 @@ for (name in grammar) { alternatives = grammar[name]; grammar[name] = (function() { - var _i, _j, _len, _len2, _ref, _results; + var _i, _j, _len, _len1, _ref, _results; _results = []; for (_i = 0, _len = alternatives.length; _i < _len; _i++) { alt = alternatives[_i]; _ref = alt[0].split(' '); - for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { token = _ref[_j]; if (!grammar[token]) tokens.push(token); } diff --git a/lib/coffee-script/lexer.js b/lib/coffee-script/lexer.js index 8d46f338..3caaab52 100644 --- a/lib/coffee-script/lexer.js +++ b/lib/coffee-script/lexer.js @@ -1,11 +1,11 @@ // Generated by CoffeeScript 1.2.1-pre (function() { - var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref2, + var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref1, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; _ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES; - _ref2 = require('./helpers'), count = _ref2.count, starts = _ref2.starts, compact = _ref2.compact, last = _ref2.last; + _ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last; exports.Lexer = Lexer = (function() { @@ -37,18 +37,18 @@ }; Lexer.prototype.identifierToken = function() { - var colon, forcedIdentifier, id, input, match, prev, tag, _ref3, _ref4; + var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3; if (!(match = IDENTIFIER.exec(this.chunk))) return 0; input = match[0], id = match[1], colon = match[2]; if (id === 'own' && this.tag() === 'FOR') { this.token('OWN', id); return id.length; } - forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref3 = prev[0]) === '.' || _ref3 === '?.' || _ref3 === '::') || !prev.spaced && prev[0] === '@'); + forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::') || !prev.spaced && prev[0] === '@'); tag = 'IDENTIFIER'; if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { tag = id.toUpperCase(); - if (tag === 'WHEN' && (_ref4 = this.tag(), __indexOf.call(LINE_BREAK, _ref4) >= 0)) { + if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) { tag = 'LEADING_WHEN'; } else if (tag === 'FOR') { this.seenFor = true; @@ -201,7 +201,7 @@ }; Lexer.prototype.regexToken = function() { - var flags, length, match, prev, regex, _ref3, _ref4; + var flags, length, match, prev, regex, _ref2, _ref3; if (this.chunk.charAt(0) !== '/') return 0; if (match = HEREGEX.exec(this.chunk)) { length = this.heregexToken(match); @@ -209,11 +209,11 @@ return length; } prev = last(this.tokens); - if (prev && (_ref3 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref3) >= 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))) return 0; - _ref4 = match, match = _ref4[0], regex = _ref4[1], flags = _ref4[2]; + _ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2]; if (regex.slice(0, 2) === '/*') { this.error('regular expressions cannot begin with `*`'); } @@ -223,7 +223,7 @@ }; Lexer.prototype.heregexToken = function(match) { - var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref3, _ref4, _ref5, _ref6; + 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, '\\/'); @@ -236,11 +236,11 @@ this.token('IDENTIFIER', 'RegExp'); this.tokens.push(['CALL_START', '(']); tokens = []; - _ref3 = this.interpolateString(body, { + _ref2 = this.interpolateString(body, { regex: true }); - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - _ref4 = _ref3[_i], tag = _ref4[0], value = _ref4[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 { @@ -251,10 +251,10 @@ tokens.push(['+', '+']); } tokens.pop(); - if (((_ref5 = tokens[0]) != null ? _ref5[0] : void 0) !== 'STRING') { + if (((_ref4 = tokens[0]) != null ? _ref4[0] : void 0) !== 'STRING') { this.tokens.push(['STRING', '""'], ['+', '+']); } - (_ref6 = this.tokens).push.apply(_ref6, tokens); + (_ref5 = this.tokens).push.apply(_ref5, tokens); if (flags) this.tokens.push([',', ','], ['STRING', '"' + flags + '"']); this.token(')', ')'); return heregex.length; @@ -354,7 +354,7 @@ }; Lexer.prototype.literalToken = function() { - var match, prev, tag, value, _ref3, _ref4, _ref5, _ref6; + var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5; if (match = OPERATOR.exec(this.chunk)) { value = match[0]; if (CODE.test(value)) this.tagParameters(); @@ -364,10 +364,10 @@ tag = value; prev = last(this.tokens); if (value === '=' && prev) { - if (!prev[1].reserved && (_ref3 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref3) >= 0)) { + if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) { this.error("reserved word \"" + (this.value()) + "\" can't be assigned"); } - if ((_ref4 = prev[1]) === '||' || _ref4 === '&&') { + if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') { prev[0] = 'COMPOUND_ASSIGN'; prev[1] += '='; return value.length; @@ -389,10 +389,10 @@ } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) { tag = 'LOGIC'; } else if (prev && !prev.spaced) { - if (value === '(' && (_ref5 = prev[0], __indexOf.call(CALLABLE, _ref5) >= 0)) { + if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) { if (prev[0] === '?') prev[0] = 'FUNC_EXIST'; tag = 'CALL_START'; - } else if (value === '[' && (_ref6 = prev[0], __indexOf.call(INDEXABLE, _ref6) >= 0)) { + } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) { tag = 'INDEX_START'; switch (prev[0]) { case '?': @@ -416,7 +416,7 @@ }; Lexer.prototype.sanitizeHeredoc = function(doc, options) { - var attempt, herecomment, indent, match, _ref3; + var attempt, herecomment, indent, match, _ref2; indent = options.indent, herecomment = options.herecomment; if (herecomment) { if (HEREDOC_ILLEGAL.test(doc)) { @@ -426,7 +426,7 @@ } else { while (match = HEREDOC_INDENT.exec(doc)) { attempt = match[1]; - if (indent === null || (0 < (_ref3 = attempt.length) && _ref3 < indent.length)) { + if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) { indent = attempt; } } @@ -468,10 +468,10 @@ }; Lexer.prototype.balancedString = function(str, end) { - var continueCount, i, letter, match, prev, stack, _i, _ref3; + var continueCount, i, letter, match, prev, stack, _i, _ref2; continueCount = 0; stack = [end]; - for (i = _i = 1, _ref3 = str.length; 1 <= _ref3 ? _i < _ref3 : _i > _ref3; i = 1 <= _ref3 ? ++_i : --_i) { + for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) { if (continueCount) { --continueCount; continue; @@ -501,7 +501,7 @@ }; Lexer.prototype.interpolateString = function(str, options) { - var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _i, _len, _ref3, _ref4, _ref5; + var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4; if (options == null) options = {}; heredoc = options.heredoc, regex = options.regex; tokens = []; @@ -523,7 +523,7 @@ rewrite: false }); nested.pop(); - if (((_ref3 = nested[0]) != null ? _ref3[0] : void 0) === 'TERMINATOR') { + if (((_ref2 = nested[0]) != null ? _ref2[0] : void 0) === 'TERMINATOR') { nested.shift(); } if (len = nested.length) { @@ -543,10 +543,10 @@ if (tokens[0][0] !== 'NEOSTRING') tokens.unshift(['', '']); if (interpolated = tokens.length > 1) this.token('(', '('); for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) { - _ref4 = tokens[i], tag = _ref4[0], value = _ref4[1]; + _ref3 = tokens[i], tag = _ref3[0], value = _ref3[1]; if (i) this.token('+', '+'); if (tag === 'TOKENS') { - (_ref5 = this.tokens).push.apply(_ref5, value); + (_ref4 = this.tokens).push.apply(_ref4, value); } else { this.token('STRING', this.makeString(value, '"', heredoc)); } @@ -581,8 +581,8 @@ }; Lexer.prototype.unfinished = function() { - var _ref3; - return LINE_CONTINUER.test(this.chunk) || ((_ref3 = this.tag()) === '\\' || _ref3 === '.' || _ref3 === '?.' || _ref3 === 'UNARY' || _ref3 === 'MATH' || _ref3 === '+' || _ref3 === '-' || _ref3 === 'SHIFT' || _ref3 === 'RELATION' || _ref3 === 'COMPARE' || _ref3 === 'LOGIC' || _ref3 === 'THROW' || _ref3 === 'EXTENDS'); + var _ref2; + return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS'); }; Lexer.prototype.escapeLines = function(str, heredoc) { diff --git a/lib/coffee-script/nodes.js b/lib/coffee-script/nodes.js index 15d39720..ab54962e 100644 --- a/lib/coffee-script/nodes.js +++ b/lib/coffee-script/nodes.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript 1.2.1-pre (function() { - var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, starts, unfoldSoak, utility, _ref, _ref2, + var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, starts, unfoldSoak, utility, _ref, _ref1, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; @@ -9,7 +9,7 @@ _ref = require('./lexer'), RESERVED = _ref.RESERVED, STRICT_PROSCRIBED = _ref.STRICT_PROSCRIBED; - _ref2 = require('./helpers'), compact = _ref2.compact, flatten = _ref2.flatten, extend = _ref2.extend, merge = _ref2.merge, del = _ref2.del, starts = _ref2.starts, ends = _ref2.ends, last = _ref2.last; + _ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last; exports.extend = extend; @@ -132,15 +132,15 @@ }; Base.prototype.eachChild = function(func) { - var attr, child, _i, _j, _len, _len2, _ref3, _ref4; + var attr, child, _i, _j, _len, _len1, _ref2, _ref3; if (!this.children) return this; - _ref3 = this.children; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - attr = _ref3[_i]; + _ref2 = this.children; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + attr = _ref2[_i]; if (this[attr]) { - _ref4 = flatten([this[attr]]); - for (_j = 0, _len2 = _ref4.length; _j < _len2; _j++) { - child = _ref4[_j]; + _ref3 = flatten([this[attr]]); + for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { + child = _ref3[_j]; if (func(child) === false) return this; } } @@ -229,20 +229,20 @@ }; Block.prototype.isStatement = function(o) { - var exp, _i, _len, _ref3; - _ref3 = this.expressions; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - exp = _ref3[_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; } return false; }; Block.prototype.jumps = function(o) { - var exp, _i, _len, _ref3; - _ref3 = this.expressions; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - exp = _ref3[_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; } }; @@ -273,13 +273,13 @@ }; Block.prototype.compileNode = function(o) { - var code, codes, node, top, _i, _len, _ref3; + var code, codes, node, top, _i, _len, _ref2; this.tab = o.indent; top = o.level === LEVEL_TOP; codes = []; - _ref3 = this.expressions; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - node = _ref3[_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 (node instanceof Block) { @@ -320,11 +320,11 @@ prelude = ""; if (!o.bare) { preludeExps = (function() { - var _i, _len, _ref3, _results; - _ref3 = this.expressions; + var _i, _len, _ref2, _results; + _ref2 = this.expressions; _results = []; - for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { - exp = _ref3[i]; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + exp = _ref2[i]; if (!(exp.unwrap() instanceof Comment)) break; _results.push(exp); } @@ -345,11 +345,11 @@ }; Block.prototype.compileWithDeclarations = function(o) { - var assigns, code, declars, exp, i, post, rest, scope, spaced, _i, _len, _ref3, _ref4, _ref5; + var assigns, code, declars, exp, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4; code = post = ''; - _ref3 = this.expressions; - for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { - exp = _ref3[i]; + _ref2 = this.expressions; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + exp = _ref2[i]; exp = exp.unwrap(); if (!(exp instanceof Comment || exp instanceof Literal)) break; } @@ -358,8 +358,8 @@ }); if (i) { rest = this.expressions.splice(i, 9e9); - _ref4 = [this.spaced, false], spaced = _ref4[0], this.spaced = _ref4[1]; - _ref5 = [this.compileNode(o), spaced], code = _ref5[0], this.spaced = _ref5[1]; + _ref3 = [this.spaced, false], spaced = _ref3[0], this.spaced = _ref3[1]; + _ref4 = [this.compileNode(o), spaced], code = _ref4[0], this.spaced = _ref4[1]; this.expressions = rest; } post = this.compileNode(o); @@ -413,8 +413,8 @@ }; Literal.prototype.isStatement = function() { - var _ref3; - return (_ref3 = this.value) === 'break' || _ref3 === 'continue' || _ref3 === 'debugger'; + var _ref2; + return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger'; }; Literal.prototype.isComplex = NO; @@ -431,8 +431,8 @@ }; Literal.prototype.compileNode = function(o) { - var code, _ref3; - code = this.isUndefined ? o.level >= LEVEL_ACCESS ? '(void 0)' : 'void 0' : this.value === 'this' ? ((_ref3 = o.scope.method) != null ? _ref3.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value; + var code, _ref2; + code = this.isUndefined ? o.level >= LEVEL_ACCESS ? '(void 0)' : 'void 0' : this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value; if (this.isStatement()) { return "" + this.tab + code + ";"; } else { @@ -467,8 +467,8 @@ Return.prototype.jumps = THIS; Return.prototype.compile = function(o, level) { - var expr, _ref3; - expr = (_ref3 = this.expression) != null ? _ref3.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 { @@ -530,10 +530,10 @@ }; Value.prototype.isAtomic = function() { - var node, _i, _len, _ref3; - _ref3 = this.properties.concat(this.base); - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - node = _ref3[_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; } return true; @@ -608,14 +608,14 @@ _this = this; if (this.unfoldedSoak != null) return this.unfoldedSoak; result = (function() { - var fst, i, ifn, prop, ref, snd, _i, _len, _ref3; + var fst, i, ifn, prop, ref, snd, _i, _len, _ref2; if (ifn = _this.base.unfoldSoak(o)) { Array.prototype.push.apply(ifn.body.properties, _this.properties); return ifn; } - _ref3 = _this.properties; - for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { - prop = _ref3[i]; + _ref2 = _this.properties; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + prop = _ref2[i]; if (!prop.soak) continue; prop.soak = false; fst = new Value(_this.base, _this.properties.slice(0, i)); @@ -680,8 +680,8 @@ Call.prototype.children = ['variable', 'args']; Call.prototype.newInstance = function() { - var base, _ref3; - base = ((_ref3 = this.variable) != null ? _ref3.base : void 0) || this.variable; + var base, _ref2; + base = ((_ref2 = this.variable) != null ? _ref2.base : void 0) || this.variable; if (base instanceof Call && !base.isNew) { base.newInstance(); } else { @@ -711,11 +711,11 @@ }; Call.prototype.unfoldSoak = function(o) { - var call, ifn, left, list, rite, _i, _len, _ref3, _ref4; + var call, ifn, left, list, rite, _i, _len, _ref2, _ref3; if (this.soak) { if (this.variable) { if (ifn = unfoldSoak(o, this, 'variable')) return ifn; - _ref3 = new Value(this.variable).cacheReference(o), left = _ref3[0], rite = _ref3[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); @@ -739,9 +739,9 @@ list.push(call); if (!((call = call.variable.base) instanceof Call)) break; } - _ref4 = list.reverse(); - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - call = _ref4[_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; @@ -755,7 +755,7 @@ }; Call.prototype.filterImplicitObjects = function(list) { - var node, nodes, obj, prop, properties, _i, _j, _len, _len2, _ref3; + var node, nodes, obj, prop, properties, _i, _j, _len, _len1, _ref2; nodes = []; for (_i = 0, _len = list.length; _i < _len; _i++) { node = list[_i]; @@ -764,9 +764,9 @@ continue; } obj = null; - _ref3 = node.base.properties; - for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { - prop = _ref3[_j]; + _ref2 = node.base.properties; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + prop = _ref2[_j]; if (prop instanceof Assign || prop instanceof Comment) { if (!obj) nodes.push(obj = new Obj(properties = [], true)); properties.push(prop); @@ -780,8 +780,8 @@ }; Call.prototype.compileNode = function(o) { - var arg, args, code, _ref3; - if ((_ref3 = this.variable) != null) _ref3.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); } @@ -927,21 +927,21 @@ } Range.prototype.compileVariables = function(o) { - var step, _ref3, _ref4, _ref5, _ref6; + var step, _ref2, _ref3, _ref4, _ref5; o = merge(o, { top: true }); - _ref3 = this.from.cache(o, LEVEL_LIST), this.fromC = _ref3[0], this.fromVar = _ref3[1]; - _ref4 = this.to.cache(o, LEVEL_LIST), this.toC = _ref4[0], this.toVar = _ref4[1]; + _ref2 = this.from.cache(o, LEVEL_LIST), this.fromC = _ref2[0], this.fromVar = _ref2[1]; + _ref3 = this.to.cache(o, LEVEL_LIST), this.toC = _ref3[0], this.toVar = _ref3[1]; if (step = del(o, 'step')) { - _ref5 = step.cache(o, LEVEL_LIST), this.step = _ref5[0], this.stepVar = _ref5[1]; + _ref4 = step.cache(o, LEVEL_LIST), this.step = _ref4[0], this.stepVar = _ref4[1]; } - _ref6 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref6[0], this.toNum = _ref6[1]; + _ref5 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref5[0], this.toNum = _ref5[1]; if (this.stepVar) return this.stepNum = this.stepVar.match(SIMPLENUM); }; Range.prototype.compileNode = function(o) { - var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref3, _ref4; + var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref2, _ref3; if (!this.fromVar) this.compileVariables(o); if (!o.index) return this.compileArray(o); known = this.fromNum && this.toNum; @@ -951,8 +951,8 @@ varPart = "" + idx + " = " + this.fromC; if (this.toC !== this.toVar) varPart += ", " + this.toC; if (this.step !== this.stepVar) varPart += ", " + this.step; - _ref3 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref3[0], gt = _ref3[1]; - condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref4 = [+this.fromNum, +this.toNum], from = _ref4[0], to = _ref4[1], _ref4), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar); + _ref2 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref2[0], gt = _ref2[1]; + condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref3 = [+this.fromNum, +this.toNum], from = _ref3[0], to = _ref3[1], _ref3), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar); stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? namedIndex ? from <= to ? "++" + idx : "--" + idx : from <= to ? "" + idx + "++" : "" + idx + "--" : namedIndex ? "" + cond + " ? ++" + idx + " : --" + idx : "" + cond + " ? " + idx + "++ : " + idx + "--"; if (namedIndex) varPart = "" + idxName + " = " + varPart; if (namedIndex) stepPart = "" + idxName + " = " + stepPart; @@ -960,11 +960,11 @@ }; Range.prototype.compileArray = function(o) { - var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref3, _ref4, _results; + var args, body, cond, hasArgs, 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 = _ref3 = +this.fromNum, _ref4 = +this.toNum; _ref3 <= _ref4 ? _i <= _ref4 : _i >= _ref4; _ref3 <= _ref4 ? _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); if (this.exclusive) range.pop(); @@ -1010,8 +1010,8 @@ } Slice.prototype.compileNode = function(o) { - var compiled, from, fromStr, to, toStr, _ref3; - _ref3 = this.range, to = _ref3.to, from = _ref3.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)) { @@ -1038,12 +1038,12 @@ Obj.prototype.children = ['properties']; Obj.prototype.compileNode = function(o) { - var i, idt, indent, join, lastNoncom, node, obj, prop, propName, propNames, props, _i, _j, _len, _len2, _ref3; + var i, idt, indent, join, lastNoncom, node, obj, prop, propName, propNames, props, _i, _j, _len, _len1, _ref2; props = this.properties; propNames = []; - _ref3 = this.properties; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - prop = _ref3[_i]; + _ref2 = this.properties; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + prop = _ref2[_i]; if (prop.isComplex()) prop = prop.variable; if (prop != null) { propName = prop.unwrapAll().value.toString(); @@ -1055,7 +1055,7 @@ } if (!props.length) return (this.front ? '({})' : '{}'); if (this.generated) { - for (_j = 0, _len2 = props.length; _j < _len2; _j++) { + for (_j = 0, _len1 = props.length; _j < _len1; _j++) { node = props[_j]; if (node instanceof Value) { throw new Error('cannot have an implicit value in an implicit object'); @@ -1065,9 +1065,9 @@ idt = o.indent += TAB; lastNoncom = this.lastNonComment(this.properties); props = (function() { - var _k, _len3, _results; + var _k, _len2, _results; _results = []; - for (i = _k = 0, _len3 = props.length; _k < _len3; i = ++_k) { + for (i = _k = 0, _len2 = props.length; _k < _len2; i = ++_k) { prop = props[i]; join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; indent = prop instanceof Comment ? '' : idt; @@ -1092,10 +1092,10 @@ }; Obj.prototype.assigns = function(name) { - var prop, _i, _len, _ref3; - _ref3 = this.properties; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - prop = _ref3[_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; } return false; @@ -1142,10 +1142,10 @@ }; Arr.prototype.assigns = function(name) { - var obj, _i, _len, _ref3; - _ref3 = this.objects; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - obj = _ref3[_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; } return false; @@ -1194,12 +1194,12 @@ }; Class.prototype.addBoundFunctions = function(o) { - var bvar, lhs, _i, _len, _ref3, _results; + var bvar, lhs, _i, _len, _ref2, _results; if (this.boundFuncs.length) { - _ref3 = this.boundFuncs; + _ref2 = this.boundFuncs; _results = []; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - bvar = _ref3[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + bvar = _ref2[_i]; lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o); _results.push(this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)"))); } @@ -1254,12 +1254,12 @@ Class.prototype.walkBody = function(name, o) { var _this = this; return this.traverseChildren(false, function(child) { - var exps, i, node, _i, _len, _ref3; + var exps, i, node, _i, _len, _ref2; if (child instanceof Class) return false; if (child instanceof Block) { - _ref3 = exps = child.expressions; - for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { - node = _ref3[i]; + _ref2 = exps = child.expressions; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + node = _ref2[i]; if (node instanceof Value && node.isObject(true)) { exps[i] = _this.addProperties(node, name, o); } @@ -1297,7 +1297,7 @@ }; Class.prototype.compileNode = function(o) { - var call, decl, klass, lname, name, params, _ref3; + var call, decl, klass, lname, name, params, _ref2; decl = this.determineName(); name = decl || '_Class'; if (name.reserved) name = "_" + name; @@ -1312,7 +1312,7 @@ this.body.expressions.unshift(new Assign(new Value(new Literal(name), [new Access(new Literal('name'))]), new Literal("'" + name + "'"))); } this.body.expressions.push(lname); - (_ref3 = this.body.expressions).unshift.apply(_ref3, this.directives); + (_ref2 = this.body.expressions).unshift.apply(_ref2, this.directives); this.addBoundFunctions(o); call = Closure.wrap(this.body); if (this.parent) { @@ -1338,13 +1338,13 @@ Assign.name = 'Assign'; function Assign(variable, value, context, options) { - var forbidden, name, _ref3; + var forbidden, name, _ref2; this.variable = variable; this.value = value; this.context = context; this.param = options && options.param; this.subpattern = options && options.subpattern; - forbidden = (_ref3 = (name = this.variable.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref3) >= 0); + forbidden = (_ref2 = (name = this.variable.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0); if (forbidden && this.context !== 'object') { throw SyntaxError("variable name may not be \"" + name + "\""); } @@ -1365,13 +1365,13 @@ }; Assign.prototype.compileNode = function(o) { - var isValue, match, name, val, varBase, _ref3, _ref4, _ref5, _ref6; + var isValue, match, name, val, varBase, _ref2, _ref3, _ref4, _ref5; if (isValue = this.variable instanceof Value) { if (this.variable.isArray() || this.variable.isObject()) { return this.compilePatternMatch(o); } if (this.variable.isSplice()) return this.compileSplice(o); - if ((_ref3 = this.context) === '||=' || _ref3 === '&&=' || _ref3 === '?=') { + if ((_ref2 = this.context) === '||=' || _ref2 === '&&=' || _ref2 === '?=') { return this.compileConditional(o); } } @@ -1390,7 +1390,7 @@ } if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) { if (match[1]) this.value.klass = match[1]; - this.value.name = (_ref4 = (_ref5 = (_ref6 = match[2]) != null ? _ref6 : match[3]) != null ? _ref5 : match[4]) != null ? _ref4 : match[5]; + this.value.name = (_ref3 = (_ref4 = (_ref5 = match[2]) != null ? _ref5 : match[3]) != null ? _ref4 : match[4]) != null ? _ref3 : match[5]; } val = this.value.compile(o, LEVEL_LIST); if (this.context === 'object') return "" + name + ": " + val; @@ -1403,7 +1403,7 @@ }; Assign.prototype.compilePatternMatch = function(o) { - var acc, assigns, code, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _i, _len, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + var acc, assigns, code, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; top = o.level === LEVEL_TOP; value = this.value; objects = this.variable.base.objects; @@ -1418,10 +1418,10 @@ isObject = this.variable.isObject(); if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) { if (obj instanceof Assign) { - _ref3 = obj, (_ref4 = _ref3.variable, idx = _ref4.base), obj = _ref3.value; + _ref2 = obj, (_ref3 = _ref2.variable, idx = _ref3.base), obj = _ref2.value; } else { if (obj.base instanceof Parens) { - _ref5 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref5[0], idx = _ref5[1]; + _ref4 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref4[0], idx = _ref4[1]; } else { idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0); } @@ -1429,7 +1429,7 @@ acc = IDENTIFIER.test(idx.unwrap().value || 0); value = new Value(value); value.properties.push(new (acc ? Access : Index)(idx)); - if (_ref6 = obj.unwrap().value, __indexOf.call(RESERVED, _ref6) >= 0) { + if (_ref5 = obj.unwrap().value, __indexOf.call(RESERVED, _ref5) >= 0) { throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (value.compile(o))); } return new Assign(obj, value, null, { @@ -1448,10 +1448,10 @@ idx = i; if (isObject) { if (obj instanceof Assign) { - _ref7 = obj, (_ref8 = _ref7.variable, idx = _ref8.base), obj = _ref7.value; + _ref6 = obj, (_ref7 = _ref6.variable, idx = _ref7.base), obj = _ref6.value; } else { if (obj.base instanceof Parens) { - _ref9 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref9[0], idx = _ref9[1]; + _ref8 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref8[0], idx = _ref8[1]; } else { idx = obj["this"] ? obj.properties[0].name : obj; } @@ -1501,8 +1501,8 @@ }; Assign.prototype.compileConditional = function(o) { - var left, right, _ref3; - _ref3 = this.variable.cacheReference(o), left = _ref3[0], right = _ref3[1]; + var left, right, _ref2; + _ref2 = this.variable.cacheReference(o), left = _ref2[0], right = _ref2[1]; if (left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) { throw new Error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been defined."); } @@ -1511,10 +1511,10 @@ }; Assign.prototype.compileSplice = function(o) { - var code, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref3, _ref4, _ref5; - _ref3 = this.variable.properties.pop().range, from = _ref3.from, to = _ref3.to, exclusive = _ref3.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); - _ref4 = (from != null ? from.cache(o, LEVEL_OP) : void 0) || ['0', '0'], fromDecl = _ref4[0], fromRef = _ref4[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; @@ -1526,7 +1526,7 @@ } else { to = "9e9"; } - _ref5 = this.value.cache(o, LEVEL_LIST), valDef = _ref5[0], valRef = _ref5[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 + ")"; @@ -1561,7 +1561,7 @@ Code.prototype.jumps = NO; Code.prototype.compileNode = function(o) { - var code, exprs, i, idt, lit, name, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _m, _n, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + var code, exprs, i, idt, lit, name, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; o.scope = new Scope(o.scope, this.body, this); o.scope.shared = del(o, 'sharedScope'); o.indent += TAB; @@ -1569,35 +1569,35 @@ delete o.isExistentialEquals; params = []; exprs = []; - _ref3 = this.paramNames(); - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - name = _ref3[_i]; + _ref2 = this.paramNames(); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + name = _ref2[_i]; if (!o.scope.check(name)) o.scope.parameter(name); } - _ref4 = this.params; - for (_j = 0, _len2 = _ref4.length; _j < _len2; _j++) { - param = _ref4[_j]; + _ref3 = this.params; + for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { + param = _ref3[_j]; if (!param.splat) continue; - _ref5 = this.params; - for (_k = 0, _len3 = _ref5.length; _k < _len3; _k++) { - p = _ref5[_k]; + _ref4 = this.params; + for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { + p = _ref4[_k]; if (p.name.value) o.scope.add(p.name.value, 'var', true); } splats = new Assign(new Value(new Arr((function() { - var _l, _len4, _ref6, _results; - _ref6 = this.params; + var _l, _len3, _ref5, _results; + _ref5 = this.params; _results = []; - for (_l = 0, _len4 = _ref6.length; _l < _len4; _l++) { - p = _ref6[_l]; + for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { + p = _ref5[_l]; _results.push(p.asReference(o)); } return _results; }).call(this))), new Value(new Literal('arguments'))); break; } - _ref6 = this.params; - for (_l = 0, _len4 = _ref6.length; _l < _len4; _l++) { - param = _ref6[_l]; + _ref5 = this.params; + for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { + param = _ref5[_l]; if (param.isComplex()) { val = ref = param.asReference(o); if (param.value) val = new Op('?', ref, param.value); @@ -1617,16 +1617,16 @@ wasEmpty = this.body.isEmpty(); if (splats) exprs.unshift(splats); if (exprs.length) { - (_ref7 = this.body.expressions).unshift.apply(_ref7, exprs); + (_ref6 = this.body.expressions).unshift.apply(_ref6, exprs); } - for (i = _m = 0, _len5 = params.length; _m < _len5; i = ++_m) { + for (i = _m = 0, _len4 = params.length; _m < _len4; i = ++_m) { p = params[i]; o.scope.parameter(params[i] = p.compile(o)); } uniqs = []; - _ref8 = this.paramNames(); - for (_n = 0, _len6 = _ref8.length; _n < _len6; _n++) { - name = _ref8[_n]; + _ref7 = this.paramNames(); + for (_n = 0, _len5 = _ref7.length; _n < _len5; _n++) { + name = _ref7[_n]; if (__indexOf.call(uniqs, name) >= 0) { throw SyntaxError("multiple parameters named '" + name + "'"); } @@ -1634,7 +1634,7 @@ } if (!(wasEmpty || this.noReturn)) this.body.makeReturn(); if (this.bound) { - if ((_ref9 = o.scope.parent.method) != null ? _ref9.bound : void 0) { + if ((_ref8 = o.scope.parent.method) != null ? _ref8.bound : void 0) { this.bound = this.context = o.scope.parent.method.context; } else if (!this["static"]) { o.scope.parent.assign('_this', 'this'); @@ -1657,11 +1657,11 @@ }; Code.prototype.paramNames = function() { - var names, param, _i, _len, _ref3; + var names, param, _i, _len, _ref2; names = []; - _ref3 = this.params; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - param = _ref3[_i]; + _ref2 = this.params; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + param = _ref2[_i]; names.push.apply(names, param.names()); } return names; @@ -1684,11 +1684,11 @@ Param.name = 'Param'; function Param(name, value, splat) { - var _ref3; + var _ref2; this.name = name; this.value = value; this.splat = splat; - if (_ref3 = (name = this.name.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref3) >= 0) { + if (_ref2 = (name = this.name.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0) { throw SyntaxError("parameter name \"" + name + "\" is not allowed"); } } @@ -1721,7 +1721,7 @@ }; Param.prototype.names = function(name) { - var atParam, names, obj, _i, _len, _ref3; + var atParam, names, obj, _i, _len, _ref2; if (name == null) name = this.name; atParam = function(obj) { var value; @@ -1735,9 +1735,9 @@ if (name instanceof Literal) return [name.value]; if (name instanceof Value) return atParam(name); names = []; - _ref3 = name.objects; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - obj = _ref3[_i]; + _ref2 = name.objects; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + obj = _ref2[_i]; if (obj instanceof Assign) { names.push(obj.variable.base.value); } else if (obj.isArray() || obj.isObject()) { @@ -1807,11 +1807,11 @@ return args[0] + (".concat(" + (args.slice(1).join(', ')) + ")"); } base = (function() { - var _j, _len2, _ref3, _results; - _ref3 = list.slice(0, index); + var _j, _len1, _ref2, _results; + _ref2 = list.slice(0, index); _results = []; - for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { - node = _ref3[_j]; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + node = _ref2[_j]; _results.push(node.compile(o, LEVEL_LIST)); } return _results; @@ -1942,17 +1942,17 @@ }; Op.prototype.isComplex = function() { - var _ref3; - return !(this.isUnary() && ((_ref3 = this.operator) === '+' || _ref3 === '-')) || this.first.isComplex(); + var _ref2; + return !(this.isUnary() && ((_ref2 = this.operator) === '+' || _ref2 === '-')) || this.first.isComplex(); }; Op.prototype.isChainable = function() { - var _ref3; - return (_ref3 = this.operator) === '<' || _ref3 === '>' || _ref3 === '>=' || _ref3 === '<=' || _ref3 === '===' || _ref3 === '!=='; + var _ref2; + return (_ref2 = this.operator) === '<' || _ref2 === '>' || _ref2 === '>=' || _ref2 === '<=' || _ref2 === '===' || _ref2 === '!=='; }; Op.prototype.invert = function() { - var allInvertable, curr, fst, op, _ref3; + var allInvertable, curr, fst, op, _ref2; if (this.isChainable() && this.first.isChainable()) { allInvertable = true; curr = this; @@ -1974,7 +1974,7 @@ return this; } else if (this.second) { return new Parens(this).invert(); - } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref3 = fst.operator) === '!' || _ref3 === 'in' || _ref3 === '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); @@ -1982,17 +1982,17 @@ }; Op.prototype.unfoldSoak = function(o) { - var _ref3; - return ((_ref3 = this.operator) === '++' || _ref3 === '--' || _ref3 === 'delete') && unfoldSoak(o, this, 'first'); + var _ref2; + return ((_ref2 = this.operator) === '++' || _ref2 === '--' || _ref2 === 'delete') && unfoldSoak(o, this, 'first'); }; Op.prototype.generateDo = function(exp) { - var call, func, param, passedParams, ref, _i, _len, _ref3; + var call, func, param, passedParams, ref, _i, _len, _ref2; passedParams = []; func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp; - _ref3 = func.params || []; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - param = _ref3[_i]; + _ref2 = func.params || []; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + param = _ref2[_i]; if (param.value) { passedParams.push(param.value); delete param.value; @@ -2006,13 +2006,13 @@ }; Op.prototype.compileNode = function(o) { - var code, isChain, _ref3, _ref4; + var code, isChain, _ref2, _ref3; isChain = this.isChainable() && this.first.isChainable(); if (!isChain) this.first.front = this.front; if (this.operator === 'delete' && o.scope.check(this.first.unwrapAll().value)) { throw SyntaxError('delete operand may not be argument or var'); } - if (((_ref3 = this.operator) === '--' || _ref3 === '++') && (_ref4 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0)) { + if (((_ref2 = this.operator) === '--' || _ref2 === '++') && (_ref3 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref3) >= 0)) { throw SyntaxError('prefix increment/decrement may not have eval or arguments operand'); } if (this.isUnary()) return this.compileUnary(o); @@ -2027,8 +2027,8 @@ }; Op.prototype.compileChain = function(o) { - var code, fst, shared, _ref3; - _ref3 = this.first.second.cache(o), this.first.second = _ref3[0], shared = _ref3[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 + ")"; @@ -2088,11 +2088,11 @@ In.prototype.invert = NEGATE; In.prototype.compileNode = function(o) { - var hasSplat, obj, _i, _len, _ref3; + var hasSplat, obj, _i, _len, _ref2; if (this.array instanceof Value && this.array.isArray()) { - _ref3 = this.array.base.objects; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - obj = _ref3[_i]; + _ref2 = this.array.base.objects; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + obj = _ref2[_i]; if (!(obj instanceof Splat)) continue; hasSplat = true; break; @@ -2103,16 +2103,16 @@ }; In.prototype.compileOrTest = function(o) { - var cmp, cnj, i, item, ref, sub, tests, _ref3, _ref4; + var cmp, cnj, i, item, ref, sub, tests, _ref2, _ref3; if (this.array.base.objects.length === 0) return "" + (!!this.negated); - _ref3 = this.object.cache(o, LEVEL_OP), sub = _ref3[0], ref = _ref3[1]; - _ref4 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref4[0], cnj = _ref4[1]; + _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 _i, _len, _ref5, _results; - _ref5 = this.array.base.objects; + var _i, _len, _ref4, _results; + _ref4 = this.array.base.objects; _results = []; - for (i = _i = 0, _len = _ref5.length; _i < _len; i = ++_i) { - item = _ref5[i]; + for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { + item = _ref4[i]; _results.push((i ? ref : sub) + cmp + item.compile(o, LEVEL_ACCESS)); } return _results; @@ -2126,8 +2126,8 @@ }; In.prototype.compileLoopTest = function(o) { - var code, ref, sub, _ref3; - _ref3 = this.object.cache(o, LEVEL_LIST), sub = _ref3[0], ref = _ref3[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; code = sub + ', ' + code; @@ -2164,8 +2164,8 @@ Try.prototype.isStatement = YES; Try.prototype.jumps = function(o) { - var _ref3; - return this.attempt.jumps(o) || ((_ref3 = this.recovery) != null ? _ref3.jumps(o) : void 0); + var _ref2; + return this.attempt.jumps(o) || ((_ref2 = this.recovery) != null ? _ref2.jumps(o) : void 0); }; Try.prototype.makeReturn = function(res) { @@ -2180,9 +2180,9 @@ errorPart = this.error ? " (" + (this.error.compile(o)) + ") " : ' '; tryPart = this.attempt.compile(o, LEVEL_TOP); catchPart = (function() { - var _ref3; + var _ref2; if (this.recovery) { - if (_ref3 = this.error.value, __indexOf.call(STRICT_PROSCRIBED, _ref3) >= 0) { + if (_ref2 = this.error.value, __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0) { throw SyntaxError("catch variable may not be \"" + this.error.value + "\""); } if (!o.scope.check(this.error.value)) { @@ -2242,11 +2242,11 @@ Existence.prototype.invert = NEGATE; Existence.prototype.compileNode = function(o) { - var cmp, cnj, code, _ref3; + var cmp, cnj, code, _ref2; this.expression.front = this.front; code = this.expression.compile(o, LEVEL_OP); if (IDENTIFIER.test(code) && !o.scope.check(code)) { - _ref3 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref3[0], cnj = _ref3[1]; + _ref2 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref2[0], cnj = _ref2[1]; code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null"; } else { code = "" + code + " " + (this.negated ? '==' : '!=') + " null"; @@ -2309,13 +2309,13 @@ For.name = 'For'; function For(body, source) { - var _ref3; + 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) { - _ref3 = [this.index, this.name], this.name = _ref3[0], this.index = _ref3[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'); @@ -2334,9 +2334,9 @@ For.prototype.children = ['body', 'source', 'guard', 'step']; For.prototype.compileNode = function(o) { - var body, defPart, forPart, forVarPart, guardPart, idt1, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, stepvar, svar, varPart, _ref3; + var body, defPart, forPart, forVarPart, guardPart, idt1, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, stepvar, svar, varPart, _ref2; body = Block.wrap([this.body]); - lastJumps = (_ref3 = last(body.expressions)) != null ? _ref3.jumps() : void 0; + lastJumps = (_ref2 = last(body.expressions)) != null ? _ref2.jumps() : void 0; if (lastJumps && lastJumps instanceof Return) this.returns = false; source = this.range ? this.source.base : this.source; scope = o.scope; @@ -2418,21 +2418,21 @@ }; For.prototype.pluckDirectCall = function(o, body) { - var base, defs, expr, fn, idx, ref, val, _i, _len, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; + var base, defs, expr, fn, idx, ref, val, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; defs = ''; - _ref3 = body.expressions; - for (idx = _i = 0, _len = _ref3.length; _i < _len; idx = ++_i) { - expr = _ref3[idx]; + _ref2 = body.expressions; + for (idx = _i = 0, _len = _ref2.length; _i < _len; idx = ++_i) { + expr = _ref2[idx]; expr = expr.unwrapAll(); if (!(expr instanceof Call)) continue; val = expr.variable.unwrapAll(); - if (!((val instanceof Code) || (val instanceof Value && ((_ref4 = val.base) != null ? _ref4.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref5 = (_ref6 = val.properties[0].name) != null ? _ref6.value : void 0) === 'call' || _ref5 === '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 = ((_ref7 = val.base) != null ? _ref7.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) _ref8 = [base, val], val.base = _ref8[0], base = _ref8[1]; + if (val.base) _ref7 = [base, val], val.base = _ref7[0], base = _ref7[1]; body.expressions[idx] = new Call(base, expr.args); defs += this.tab + new Assign(ref, fn).compile(o, LEVEL_TOP) + ';\n'; } @@ -2460,45 +2460,45 @@ Switch.prototype.isStatement = YES; Switch.prototype.jumps = function(o) { - var block, conds, _i, _len, _ref3, _ref4, _ref5; + var block, conds, _i, _len, _ref2, _ref3, _ref4; if (o == null) { o = { block: true }; } - _ref3 = this.cases; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - _ref4 = _ref3[_i], conds = _ref4[0], block = _ref4[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 (_ref5 = this.otherwise) != null ? _ref5.jumps(o) : void 0; + return (_ref4 = this.otherwise) != null ? _ref4.jumps(o) : void 0; }; Switch.prototype.makeReturn = function(res) { - var pair, _i, _len, _ref3, _ref4; - _ref3 = this.cases; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - pair = _ref3[_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(res); } if (res) { this.otherwise || (this.otherwise = new Block([new Literal('void 0')])); } - if ((_ref4 = this.otherwise) != null) _ref4.makeReturn(res); + if ((_ref3 = this.otherwise) != null) _ref3.makeReturn(res); return this; }; Switch.prototype.compileNode = function(o) { - var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _j, _len, _len2, _ref3, _ref4, _ref5, _ref6; + var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _j, _len, _len1, _ref2, _ref3, _ref4, _ref5; idt1 = o.indent + TAB; idt2 = o.indent = idt1 + TAB; - code = this.tab + ("switch (" + (((_ref3 = this.subject) != null ? _ref3.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n"); - _ref4 = this.cases; - for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { - _ref5 = _ref4[i], conditions = _ref5[0], block = _ref5[1]; - _ref6 = flatten([conditions]); - for (_j = 0, _len2 = _ref6.length; _j < _len2; _j++) { - cond = _ref6[_j]; + code = this.tab + ("switch (" + (((_ref2 = this.subject) != null ? _ref2.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n"); + _ref3 = this.cases; + for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { + _ref4 = _ref3[i], conditions = _ref4[0], block = _ref4[1]; + _ref5 = flatten([conditions]); + for (_j = 0, _len1 = _ref5.length; _j < _len1; _j++) { + cond = _ref5[_j]; if (!this.subject) cond = cond.invert(); code += idt1 + ("case " + (cond.compile(o, LEVEL_PAREN)) + ":\n"); } @@ -2538,13 +2538,13 @@ If.prototype.children = ['condition', 'body', 'elseBody']; If.prototype.bodyNode = function() { - var _ref3; - return (_ref3 = this.body) != null ? _ref3.unwrap() : void 0; + var _ref2; + return (_ref2 = this.body) != null ? _ref2.unwrap() : void 0; }; If.prototype.elseBodyNode = function() { - var _ref3; - return (_ref3 = this.elseBody) != null ? _ref3.unwrap() : void 0; + var _ref2; + return (_ref2 = this.elseBody) != null ? _ref2.unwrap() : void 0; }; If.prototype.addElse = function(elseBody) { @@ -2558,13 +2558,13 @@ }; If.prototype.isStatement = function(o) { - var _ref3; - return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref3 = this.elseBodyNode()) != null ? _ref3.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 _ref3; - return this.body.jumps(o) || ((_ref3 = this.elseBody) != null ? _ref3.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) { @@ -2593,7 +2593,7 @@ }; If.prototype.compileStatement = function(o) { - var body, bodyc, child, cond, exeq, ifPart, _ref3; + var body, bodyc, child, cond, exeq, ifPart, _ref2; child = del(o, 'chainChild'); exeq = del(o, 'isExistentialEquals'); if (exeq) { @@ -2605,7 +2605,7 @@ o.indent += TAB; body = this.ensureBlock(this.body); bodyc = body.compile(o); - if (1 === ((_ref3 = body.expressions) != null ? _ref3.length : void 0) && !this.elseBody && !child && bodyc && cond && -1 === (bodyc.indexOf('\n')) && 80 > cond.length + bodyc.length) { + if (1 === ((_ref2 = body.expressions) != null ? _ref2.length : void 0) && !this.elseBody && !child && bodyc && cond && -1 === (bodyc.indexOf('\n')) && 80 > cond.length + bodyc.length) { return "" + this.tab + "if (" + cond + ") " + (bodyc.replace(/^\s+/, '')); } if (bodyc) bodyc = "\n" + bodyc + "\n" + this.tab; diff --git a/lib/coffee-script/optparse.js b/lib/coffee-script/optparse.js index ae6afa5e..2cef6ed2 100644 --- a/lib/coffee-script/optparse.js +++ b/lib/coffee-script/optparse.js @@ -12,7 +12,7 @@ } OptionParser.prototype.parse = function(args) { - var arg, i, isOption, matchedRule, options, originalArgs, pos, rule, seenNonOptionArg, skippingArgument, value, _i, _j, _len, _len2, _ref; + var arg, i, isOption, matchedRule, options, originalArgs, pos, rule, seenNonOptionArg, skippingArgument, value, _i, _j, _len, _len1, _ref; options = { "arguments": [] }; @@ -35,7 +35,7 @@ if (!seenNonOptionArg) { matchedRule = false; _ref = this.rules; - for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { rule = _ref[_j]; if (rule.shortFlag === arg || rule.longFlag === arg) { value = true; @@ -111,14 +111,14 @@ }; normalizeArguments = function(args) { - var arg, l, match, result, _i, _j, _len, _len2, _ref; + var arg, l, match, result, _i, _j, _len, _len1, _ref; args = args.slice(0); result = []; for (_i = 0, _len = args.length; _i < _len; _i++) { arg = args[_i]; if (match = arg.match(MULTI_FLAG)) { _ref = match[1].split(''); - for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { l = _ref[_j]; result.push('-' + l); } diff --git a/lib/coffee-script/repl.js b/lib/coffee-script/repl.js index 291dbbca..d04b7cf5 100644 --- a/lib/coffee-script/repl.js +++ b/lib/coffee-script/repl.js @@ -61,11 +61,11 @@ if (free != null) { vars = Script.runInThisContext('Object.getOwnPropertyNames(Object(this))'); keywords = (function() { - var _i, _len, _ref2, _results; - _ref2 = CoffeeScript.RESERVED; + var _i, _len, _ref1, _results; + _ref1 = CoffeeScript.RESERVED; _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - r = _ref2[_i]; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + r = _ref1[_i]; if (r.slice(0, 2) !== '__') _results.push(r); } return _results; diff --git a/lib/coffee-script/rewriter.js b/lib/coffee-script/rewriter.js index 867c5f4b..73d92210 100644 --- a/lib/coffee-script/rewriter.js +++ b/lib/coffee-script/rewriter.js @@ -34,7 +34,7 @@ }; Rewriter.prototype.detectEnd = function(i, condition, action) { - var levels, token, tokens, _ref, _ref2; + var levels, token, tokens, _ref, _ref1; tokens = this.tokens; levels = 0; while (token = tokens[i]) { @@ -44,7 +44,7 @@ if (!token || levels < 0) return action.call(this, token, i - 1); if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) { levels += 1; - } else if (_ref2 = token[0], __indexOf.call(EXPRESSION_END, _ref2) >= 0) { + } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) { levels -= 1; } i += 1; @@ -111,12 +111,12 @@ sameLine = true; startIndent = 0; condition = function(token, i) { - var one, tag, three, two, _ref, _ref2; + var one, tag, three, two, _ref, _ref1; _ref = this.tokens.slice(i + 1, (i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2]; if ('HERECOMMENT' === (one != null ? one[0] : void 0)) return false; tag = token[0]; if (__indexOf.call(LINEBREAKS, tag) >= 0) sameLine = false; - return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine)) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref2 = one[0]) !== 'IDENTIFIER' && _ref2 !== 'NUMBER' && _ref2 !== 'STRING' && _ref2 !== '@' && _ref2 !== 'TERMINATOR' && _ref2 !== 'OUTDENT')); + return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine)) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref1 = one[0]) !== 'IDENTIFIER' && _ref1 !== 'NUMBER' && _ref1 !== 'STRING' && _ref1 !== '@' && _ref1 !== 'TERMINATOR' && _ref1 !== 'OUTDENT')); }; action = function(token, i) { var tok; @@ -124,7 +124,7 @@ return this.tokens.splice(i, 0, tok); }; return this.scanTokens(function(token, i, tokens) { - var ago, idx, prevTag, tag, tok, value, _ref, _ref2; + var ago, idx, prevTag, tag, tok, value, _ref, _ref1; if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) { stack.push([(tag === 'INDENT' && this.tag(i - 1) === '{' ? '{' : tag), i]); return 1; @@ -133,7 +133,7 @@ start = stack.pop(); return 1; } - if (!(tag === ':' && ((ago = this.tag(i - 2)) === ':' || ((_ref2 = stack[stack.length - 1]) != null ? _ref2[0] : void 0) !== '{'))) { + if (!(tag === ':' && ((ago = this.tag(i - 2)) === ':' || ((_ref1 = stack[stack.length - 1]) != null ? _ref1[0] : void 0) !== '{'))) { return 1; } sameLine = true; @@ -157,7 +157,7 @@ var action, condition, noCall, seenControl, seenSingle; noCall = seenSingle = seenControl = false; condition = function(token, i) { - var post, tag, _ref, _ref2; + var post, tag, _ref, _ref1; tag = token[0]; if (!seenSingle && token.fromThen) return true; if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>' || tag === 'CLASS') { @@ -169,25 +169,25 @@ 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' && !seenControl)) && (tag !== 'INDENT' || (((_ref = this.tag(i - 2)) !== 'CLASS' && _ref !== 'EXTENDS') && (_ref2 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref2) < 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' && !seenControl)) && (tag !== 'INDENT' || (((_ref = this.tag(i - 2)) !== 'CLASS' && _ref !== 'EXTENDS') && (_ref1 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref1) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{'))); }; action = function(token, i) { return this.tokens.splice(i, 0, this.generate('CALL_END', ')', token[2])); }; return this.scanTokens(function(token, i, tokens) { - var callObject, current, next, prev, tag, _ref, _ref2, _ref3; + var callObject, current, next, prev, tag, _ref, _ref1, _ref2; tag = token[0]; if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') { noCall = true; } _ref = tokens.slice(i - 1, (i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2]; - callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0); + callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref1 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref1) >= 0); seenSingle = false; seenControl = false; if (__indexOf.call(LINEBREAKS, tag) >= 0) noCall = false; if (prev && !prev.spaced && tag === '?') token.call = true; if (token.fromThen) return 1; - if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref3 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref3) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) { + if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) { return 1; } tokens.splice(i, 0, this.generate('CALL_START', '(', token[2])); @@ -208,7 +208,7 @@ return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); }; return this.scanTokens(function(token, i, tokens) { - var tag, _ref, _ref2; + var tag, _ref, _ref1; tag = token[0]; if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') { tokens.splice(i, 1); @@ -224,7 +224,7 @@ } if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { starter = tag; - _ref2 = this.indentation(token, true), indent = _ref2[0], outdent = _ref2[1]; + _ref1 = this.indentation(token, true), indent = _ref1[0], outdent = _ref1[1]; if (starter === 'THEN') indent.fromThen = true; tokens.splice(i + 1, 0, indent); this.detectEnd(i + 2, condition, action); diff --git a/lib/coffee-script/scope.js b/lib/coffee-script/scope.js index ccadbe0d..65368eb9 100644 --- a/lib/coffee-script/scope.js +++ b/lib/coffee-script/scope.js @@ -48,25 +48,25 @@ }; Scope.prototype.check = function(name, immediate) { - var found, _ref2; + var found, _ref1; found = !!this.type(name); if (found || immediate) return found; - return !!((_ref2 = this.parent) != null ? _ref2.check(name) : void 0); + return !!((_ref1 = this.parent) != null ? _ref1.check(name) : void 0); }; Scope.prototype.temporary = function(name, index) { if (name.length > 1) { - return '_' + name + (index > 1 ? index : ''); + return '_' + name + (index > 1 ? index - 1 : ''); } else { return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); } }; Scope.prototype.type = function(name) { - var v, _i, _len, _ref2; - _ref2 = this.variables; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - v = _ref2[_i]; + var v, _i, _len, _ref1; + _ref1 = this.variables; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; if (v.name === name) return v.type; } return null; @@ -96,12 +96,12 @@ }; Scope.prototype.declaredVariables = function() { - var realVars, tempVars, v, _i, _len, _ref2; + var realVars, tempVars, v, _i, _len, _ref1; realVars = []; tempVars = []; - _ref2 = this.variables; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - v = _ref2[_i]; + _ref1 = this.variables; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; if (v.type === 'var') { (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); } @@ -110,11 +110,11 @@ }; Scope.prototype.assignedVariables = function() { - var v, _i, _len, _ref2, _results; - _ref2 = this.variables; + var v, _i, _len, _ref1, _results; + _ref1 = this.variables; _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - v = _ref2[_i]; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; if (v.type.assigned) _results.push("" + v.name + " = " + v.type.value); } return _results; diff --git a/src/scope.coffee b/src/scope.coffee index bb95eb63..0f34e27a 100644 --- a/src/scope.coffee +++ b/src/scope.coffee @@ -53,7 +53,7 @@ exports.Scope = class Scope # Generate a temporary variable name at the given index. temporary: (name, index) -> if name.length > 1 - '_' + name + if index > 1 then index else '' + '_' + name + if index > 1 then index - 1 else '' else '_' + (index + parseInt name, 36).toString(36).replace /\d/g, 'a'