diff --git a/lib/browser.js b/lib/browser.js index 8be848d9..a5db05c2 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -19,10 +19,10 @@ return xhr.send(null); }; processScripts = function() { - var _a, _b, _c, script; - _b = document.getElementsByTagName('script'); - for (_a = 0, _c = _b.length; _a < _c; _a++) { - script = _b[_a]; + var _cache, _cache2, _index, script; + _cache = document.getElementsByTagName('script'); + for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) { + script = _cache[_index]; if (script.type === 'text/coffeescript') { if (script.src) { grindRemote(script.src); diff --git a/lib/cake.js b/lib/cake.js index 2fbf2d88..cd6b49dc 100755 --- a/lib/cake.js +++ b/lib/cake.js @@ -11,11 +11,11 @@ oparse = null; helpers.extend(global, { task: function(name, description, action) { - var _a; + var _cache; if (!(action)) { - _a = [description, action]; - action = _a[0]; - description = _a[1]; + _cache = [description, action]; + action = _cache[0]; + description = _cache[1]; } return (tasks[name] = { name: name, @@ -35,7 +35,7 @@ }); exports.run = function() { return path.exists('Cakefile', function(exists) { - var _a, _b, _c, _d, arg, args; + var _cache, _cache2, _index, _result, arg, args; if (!(exists)) { throw new Error("Cakefile not found in " + (process.cwd())); } @@ -48,27 +48,27 @@ return printTasks(); } options = oparse.parse(args); - _a = []; _c = options.arguments; - for (_b = 0, _d = _c.length; _b < _d; _b++) { - arg = _c[_b]; - _a.push(invoke(arg)); + _result = []; _cache = options.arguments; + for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) { + arg = _cache[_index]; + _result.push(invoke(arg)); } - return _a; + return _result; }); }; printTasks = function() { - var _a, _b, desc, i, name, spaces, task; + var _cache, _result, desc, i, name, spaces, task; puts(''); - _a = tasks; - for (name in _a) { - task = _a[name]; + _cache = tasks; + for (name in _cache) { + task = _cache[name]; spaces = 20 - name.length; spaces = spaces > 0 ? (function() { - _b = []; + _result = []; for (i = 0; (0 <= spaces ? i <= spaces : i >= spaces); (0 <= spaces ? i += 1 : i -= 1)) { - _b.push(' '); + _result.push(' '); } - return _b; + return _result; })().join('') : ''; desc = task.description ? ("# " + (task.description)) : ''; puts("cake " + (name) + (spaces) + " " + (desc)); diff --git a/lib/command.js b/lib/command.js index 36d89d57..f1bffcb9 100644 --- a/lib/command.js +++ b/lib/command.js @@ -1,16 +1,16 @@ (function() { - var BANNER, CoffeeScript, EventEmitter, SWITCHES, _a, _b, _c, compileOptions, compileScript, compileScripts, compileStdio, exec, fs, helpers, lint, optionParser, optparse, opts, parseOptions, path, printTokens, sources, spawn, usage, version, watch, writeJs; + var BANNER, CoffeeScript, EventEmitter, SWITCHES, _cache, _cache2, _cache3, compileOptions, compileScript, compileScripts, compileStdio, exec, fs, helpers, lint, optionParser, optparse, opts, parseOptions, path, printTokens, sources, spawn, usage, version, watch, writeJs; fs = require('fs'); path = require('path'); optparse = require('./optparse'); CoffeeScript = require('./coffee-script'); - _a = require('./helpers'); - helpers = _a.helpers; - _b = require('child_process'); - spawn = _b.spawn; - exec = _b.exec; - _c = require('events'); - EventEmitter = _c.EventEmitter; + _cache = require('./helpers'); + helpers = _cache.helpers; + _cache2 = require('child_process'); + spawn = _cache2.spawn; + exec = _cache2.exec; + _cache3 = require('events'); + EventEmitter = _cache3.EventEmitter; helpers.extend(CoffeeScript, new EventEmitter()); global.CoffeeScript = CoffeeScript; BANNER = 'coffee compiles CoffeeScript source files into JavaScript.\n\nUsage:\n coffee path/to/script.coffee'; @@ -53,13 +53,13 @@ return compileScripts(); }; compileScripts = function() { - var _d, _e, _f, _g; - _d = []; _f = sources; - for (_e = 0, _g = _f.length; _e < _g; _e++) { + var _cache4, _cache5, _index, _result; + _result = []; _cache4 = sources; + for (_index = 0, _cache5 = _cache4.length; _index < _cache5; _index++) { (function() { var base, compile; - var source = _f[_e]; - return _d.push((function() { + var source = _cache4[_index]; + return _result.push((function() { base = source; compile = function(source, topLevel) { return path.exists(source, function(exists) { @@ -69,13 +69,13 @@ return fs.stat(source, function(err, stats) { if (stats.isDirectory()) { return fs.readdir(source, function(err, files) { - var _h, _i, _j, _k, file; - _h = []; _j = files; - for (_i = 0, _k = _j.length; _i < _k; _i++) { - file = _j[_i]; - _h.push(compile(path.join(source, file))); + var _cache6, _cache7, _index2, _result2, file; + _result2 = []; _cache6 = files; + for (_index2 = 0, _cache7 = _cache6.length; _index2 < _cache7; _index2++) { + file = _cache6[_index2]; + _result2.push(compile(path.join(source, file))); } - return _h; + return _result2; }); } else if (topLevel || path.extname(source) === '.coffee') { fs.readFile(source, function(err, code) { @@ -92,16 +92,16 @@ })()); })(); } - return _d; + return _result; }; compileScript = function(file, input, base) { - var _d, _e, _f, o, options, req, t, task; + var _cache4, _cache5, _index, o, options, req, t, task; o = opts; options = compileOptions(file); if (o.require) { - _e = o.require; - for (_d = 0, _f = _e.length; _d < _f; _d++) { - req = _e[_d]; + _cache4 = o.require; + for (_index = 0, _cache5 = _cache4.length; _index < _cache5; _index++) { + req = _cache4[_index]; require(helpers.starts(req, '.') ? fs.realpathSync(req) : req); } } @@ -204,19 +204,19 @@ return jsl.stdin.end(); }; printTokens = function(tokens) { - var _d, _e, _f, _g, _h, strings, tag, token, value; + var _cache4, _cache5, _cache6, _index, _result, strings, tag, token, value; strings = (function() { - _d = []; _f = tokens; - for (_e = 0, _g = _f.length; _e < _g; _e++) { - token = _f[_e]; - _d.push((function() { - _h = [token[0], token[1].toString().replace(/\n/, '\\n')]; - tag = _h[0]; - value = _h[1]; + _result = []; _cache4 = tokens; + for (_index = 0, _cache5 = _cache4.length; _index < _cache5; _index++) { + token = _cache4[_index]; + _result.push((function() { + _cache6 = [token[0], token[1].toString().replace(/\n/, '\\n')]; + tag = _cache6[0]; + value = _cache6[1]; return "[" + (tag) + " " + (value) + "]"; })()); } - return _d; + return _result; })(); return puts(strings.join(' ')); }; diff --git a/lib/grammar.js b/lib/grammar.js index 1c8a4c84..99c3f798 100644 --- a/lib/grammar.js +++ b/lib/grammar.js @@ -1,5 +1,5 @@ (function() { - var Parser, _a, _b, _c, _d, _e, _f, _g, _h, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; + var Parser, _cache, _cache2, _cache3, _cache4, _cache5, _index, _index2, _result, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; var __hasProp = Object.prototype.hasOwnProperty; Parser = require('jison').Parser; unwrap = /function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/; @@ -612,18 +612,18 @@ }; operators = [["right", '?', 'NEW'], ["left", 'CALL_START', 'CALL_END'], ["nonassoc", '++', '--'], ["right", 'UNARY'], ["left", 'MATH'], ["left", '+', '-'], ["left", 'SHIFT'], ["left", 'COMPARE'], ["left", 'INSTANCEOF'], ["left", '==', '!='], ["left", 'LOGIC'], ["right", 'COMPOUND_ASSIGN'], ["left", '.'], ["nonassoc", 'INDENT', 'OUTDENT'], ["right", 'WHEN', 'LEADING_WHEN', 'IN', 'OF', 'BY', 'THROW'], ["right", 'IF', 'UNLESS', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS', 'EXTENDS'], ["right", '=', ':', 'RETURN'], ["right", '->', '=>', 'UNLESS', 'POST_IF', 'POST_UNLESS']]; tokens = []; - _a = grammar; - for (name in _a) { - if (!__hasProp.call(_a, name)) continue; - alternatives = _a[name]; + _cache = grammar; + for (name in _cache) { + if (!__hasProp.call(_cache, name)) continue; + alternatives = _cache[name]; grammar[name] = (function() { - _b = []; _d = alternatives; - for (_c = 0, _e = _d.length; _c < _e; _c++) { - alt = _d[_c]; - _b.push((function() { - _g = alt[0].split(' '); - for (_f = 0, _h = _g.length; _f < _h; _f++) { - token = _g[_f]; + _result = []; _cache2 = alternatives; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + alt = _cache2[_index]; + _result.push((function() { + _cache4 = alt[0].split(' '); + for (_index2 = 0, _cache5 = _cache4.length; _index2 < _cache5; _index2++) { + token = _cache4[_index2]; if (!(grammar[token])) { tokens.push(token); } @@ -634,7 +634,7 @@ return alt; })()); } - return _b; + return _result; })(); } exports.parser = new Parser({ diff --git a/lib/helpers.js b/lib/helpers.js index 20c44842..79810ef6 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -5,13 +5,13 @@ } helpers = (exports.helpers = {}); helpers.indexOf = (indexOf = function(array, item, from) { - var _a, _b, index, other; + var _cache, _cache2, index, other; if (array.indexOf) { return array.indexOf(item, from); } - _a = array; - for (index = 0, _b = _a.length; index < _b; index++) { - other = _a[index]; + _cache = array; + for (index = 0, _cache2 = _cache.length; index < _cache2; index++) { + other = _cache[index]; if (other === item && (!from || (from <= index))) { return index; } @@ -30,15 +30,15 @@ return string.substring(start, start + literal.length) === literal; }); helpers.compact = (compact = function(array) { - var _a, _b, _c, _d, item; - _a = []; _c = array; - for (_b = 0, _d = _c.length; _b < _d; _b++) { - item = _c[_b]; + var _cache, _cache2, _index, _result, item; + _result = []; _cache = array; + for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) { + item = _cache[_index]; if (item) { - _a.push(item); + _result.push(item); } } - return _a; + return _result; }); helpers.count = (count = function(string, letter) { var num, pos; @@ -51,37 +51,37 @@ return num; }); helpers.merge = (merge = function(options, overrides) { - var _a, _b, fresh, key, val; + var _cache, _cache2, fresh, key, val; fresh = {}; - _a = options; - for (key in _a) { - val = _a[key]; + _cache = options; + for (key in _cache) { + val = _cache[key]; (fresh[key] = val); } if (overrides) { - _b = overrides; - for (key in _b) { - val = _b[key]; + _cache2 = overrides; + for (key in _cache2) { + val = _cache2[key]; (fresh[key] = val); } } return fresh; }); helpers.extend = (extend = function(object, properties) { - var _a, _b, key, val; - _a = []; _b = properties; - for (key in _b) { - val = _b[key]; - _a.push(object[key] = val); + var _cache, _result, key, val; + _result = []; _cache = properties; + for (key in _cache) { + val = _cache[key]; + _result.push(object[key] = val); } - return _a; + return _result; }); helpers.flatten = (flatten = function(array) { - var _a, _b, _c, item, memo; + var _cache, _cache2, _index, item, memo; memo = []; - _b = array; - for (_a = 0, _c = _b.length; _a < _c; _a++) { - item = _b[_a]; + _cache = array; + for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) { + item = _cache[_index]; if (item instanceof Array) { memo = memo.concat(item); } else { diff --git a/lib/index.js b/lib/index.js index 6bf0e654..5201e6ca 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,10 +1,10 @@ (function() { - var _a, key, val; + var _cache, key, val; var __hasProp = Object.prototype.hasOwnProperty; - _a = require('./coffee-script'); - for (key in _a) { - if (!__hasProp.call(_a, key)) continue; - val = _a[key]; + _cache = require('./coffee-script'); + for (key in _cache) { + if (!__hasProp.call(_cache, key)) continue; + val = _cache[key]; (exports[key] = val); } })(); diff --git a/lib/lexer.js b/lib/lexer.js index 0f6829ad..26b93871 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -1,21 +1,21 @@ (function() { - var ASSIGNED, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, CONVERSIONS, HEREDOC, HEREDOC_INDENT, IDENTIFIER, JS_CLEANER, JS_FORBIDDEN, JS_KEYWORDS, LAST_DENT, LAST_DENTS, LINE_BREAK, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NEXT_CHARACTER, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX_END, REGEX_ESCAPE, REGEX_INTERPOLATION, REGEX_START, RESERVED, Rewriter, SHIFT, UNARY, WHITESPACE, _a, _b, _c, compact, count, helpers, include, starts; + var ASSIGNED, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, CONVERSIONS, HEREDOC, HEREDOC_INDENT, IDENTIFIER, JS_CLEANER, JS_FORBIDDEN, JS_KEYWORDS, LAST_DENT, LAST_DENTS, LINE_BREAK, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NEXT_CHARACTER, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX_END, REGEX_ESCAPE, REGEX_INTERPOLATION, REGEX_START, RESERVED, Rewriter, SHIFT, UNARY, WHITESPACE, _cache, _cache2, _cache3, compact, count, helpers, include, starts; var __slice = Array.prototype.slice; if (typeof process !== "undefined" && process !== null) { - _a = require('./rewriter'); - Rewriter = _a.Rewriter; - _b = require('./helpers'); - helpers = _b.helpers; + _cache = require('./rewriter'); + Rewriter = _cache.Rewriter; + _cache2 = require('./helpers'); + helpers = _cache2.helpers; } else { this.exports = this; Rewriter = this.Rewriter; helpers = this.helpers; } - _c = helpers; - include = _c.include; - count = _c.count; - starts = _c.starts; - compact = _c.compact; + _cache3 = helpers; + include = _cache3.include; + count = _cache3.count; + starts = _cache3.starts; + compact = _cache3.compact; exports.Lexer = (function() { Lexer = function() {}; Lexer.prototype.tokenize = function(code, options) { @@ -192,11 +192,11 @@ return true; }; Lexer.prototype.regexToken = function() { - var _d, end, first, flags, regex, str; + var _cache4, end, first, flags, regex, str; if (!(first = this.chunk.match(REGEX_START))) { return false; } - if (first[1] === ' ' && !('CALL_START' === (_d = this.tag()) || '=' === _d)) { + if (first[1] === ' ' && !('CALL_START' === (_cache4 = this.tag()) || '=' === _cache4)) { return false; } if (include(NOT_REGEX, this.tag())) { @@ -320,7 +320,7 @@ return true; }; Lexer.prototype.literalToken = function() { - var _d, match, prev, space, spaced, tag, value; + var _cache4, match, prev, space, spaced, tag, value; match = this.chunk.match(OPERATOR); value = match && match[1]; space = match && match[2]; @@ -335,7 +335,7 @@ if (include(JS_FORBIDDEN, this.value())) { this.assignmentError(); } - if (('or' === (_d = this.value()) || 'and' === _d)) { + if (('or' === (_cache4 = this.value()) || 'and' === _cache4)) { this.tokens.splice(this.tokens.length - 1, 1, ['COMPOUND_ASSIGN', CONVERSIONS[this.value()] + '=', prev[2]]); return true; } @@ -395,14 +395,14 @@ return accessor ? 'accessor' : false; }; Lexer.prototype.sanitizeHeredoc = function(doc, options) { - var _d, attempt, indent, match; + var _cache4, attempt, indent, match; indent = options.indent; if (options.herecomment && !include(doc, '\n')) { return doc; } if (!(options.herecomment)) { while ((match = HEREDOC_INDENT.exec(doc)) !== null) { - attempt = (typeof (_d = match[2]) !== "undefined" && _d !== null) ? match[2] : match[3]; + attempt = (typeof (_cache4 = match[2]) !== "undefined" && _cache4 !== null) ? match[2] : match[3]; if (!(typeof indent !== "undefined" && indent !== null) || attempt.length < indent.length) { indent = attempt; } @@ -451,7 +451,7 @@ throw new Error("SyntaxError: Reserved word \"" + (this.value()) + "\" on line " + (this.line + 1) + " can't be assigned"); }; Lexer.prototype.balancedString = function(str, delimited, options) { - var _d, _e, _f, _g, close, i, levels, open, pair, slash; + var _cache4, _cache5, _cache6, _index, close, i, levels, open, pair, slash; options || (options = {}); slash = delimited[0][0] === '/'; levels = []; @@ -460,12 +460,12 @@ if (levels.length && starts(str, '\\', i)) { i += 1; } else { - _e = delimited; - for (_d = 0, _f = _e.length; _d < _f; _d++) { - pair = _e[_d]; - _g = pair; - open = _g[0]; - close = _g[1]; + _cache4 = delimited; + for (_index = 0, _cache5 = _cache4.length; _index < _cache5; _index++) { + pair = _cache4[_index]; + _cache6 = pair; + open = _cache6[0]; + close = _cache6[1]; if (levels.length && starts(str, close, i) && levels[levels.length - 1] === pair) { levels.pop(); i += close.length - 1; @@ -494,7 +494,7 @@ return !i ? false : str.substring(0, i); }; Lexer.prototype.interpolateString = function(str, options) { - var _d, _e, _f, _g, _h, _i, escaped, expr, i, idx, inner, interpolated, lexer, nested, pi, quote, tag, tok, token, tokens, value; + var _cache4, _cache5, _cache6, _cache7, _cache8, _cache9, escaped, expr, i, idx, inner, interpolated, lexer, nested, pi, quote, tag, tok, token, tokens, value; options || (options = {}); if (str.length < 3 || !starts(str, '"')) { return this.token('STRING', str); @@ -502,9 +502,9 @@ lexer = new Lexer(); tokens = []; quote = str.substring(0, 1); - _d = [1, 1]; - i = _d[0]; - pi = _d[1]; + _cache4 = [1, 1]; + i = _cache4[0]; + pi = _cache4[1]; while (i < str.length - 1) { if (starts(str, '\\', i)) { i += 1; @@ -520,9 +520,9 @@ nested = lexer.tokenize("(" + (inner) + ")", { line: this.line }); - _e = nested; - for (idx = 0, _f = _e.length; idx < _f; idx++) { - tok = _e[idx]; + _cache5 = nested; + for (idx = 0, _cache6 = _cache5.length; idx < _cache6; idx++) { + tok = _cache5[idx]; if (tok[0] === 'CALL_END') { (tok[0] = ')'); } @@ -547,12 +547,12 @@ if (interpolated) { this.token('(', '('); } - _g = tokens; - for (i = 0, _h = _g.length; i < _h; i++) { - token = _g[i]; - _i = token; - tag = _i[0]; - value = _i[1]; + _cache7 = tokens; + for (i = 0, _cache8 = _cache7.length; i < _cache8; i++) { + token = _cache7[i]; + _cache9 = token; + tag = _cache9[0]; + value = _cache9[1]; if (tag === 'TOKENS') { this.tokens = this.tokens.concat(value); } else if (tag === 'STRING' && options.escapeQuotes) { diff --git a/lib/nodes.js b/lib/nodes.js index 0e92e2ab..b0c230b7 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -1,5 +1,5 @@ (function() { - var AccessorNode, ArrayNode, AssignNode, BaseNode, CallNode, ClassNode, ClosureNode, CodeNode, CommentNode, ExistenceNode, Expressions, ExtendsNode, ForNode, IDENTIFIER, IS_STRING, IfNode, InNode, IndexNode, LiteralNode, NUMBER, ObjectNode, OpNode, ParamNode, ParentheticalNode, PushNode, RangeNode, ReturnNode, SIMPLENUM, Scope, SliceNode, SplatNode, SwitchNode, TAB, TRAILING_WHITESPACE, ThrowNode, TryNode, UTILITIES, ValueNode, WhileNode, _a, compact, del, ends, flatten, helpers, include, indexOf, literal, merge, starts, utility; + var AccessorNode, ArrayNode, AssignNode, BaseNode, CallNode, ClassNode, ClosureNode, CodeNode, CommentNode, ExistenceNode, Expressions, ExtendsNode, ForNode, IDENTIFIER, IS_STRING, IfNode, InNode, IndexNode, LiteralNode, NUMBER, ObjectNode, OpNode, ParamNode, ParentheticalNode, PushNode, RangeNode, ReturnNode, SIMPLENUM, Scope, SliceNode, SplatNode, SwitchNode, TAB, TRAILING_WHITESPACE, ThrowNode, TryNode, UTILITIES, ValueNode, WhileNode, _cache, compact, del, ends, flatten, helpers, include, indexOf, literal, merge, starts, utility; var __extends = function(child, parent) { var ctor = function(){}; ctor.prototype = parent.prototype; @@ -16,15 +16,15 @@ helpers = this.helpers; Scope = this.Scope; } - _a = helpers; - compact = _a.compact; - flatten = _a.flatten; - merge = _a.merge; - del = _a.del; - include = _a.include; - indexOf = _a.indexOf; - starts = _a.starts; - ends = _a.ends; + _cache = helpers; + compact = _cache.compact; + flatten = _cache.flatten; + merge = _cache.merge; + del = _cache.del; + include = _cache.include; + indexOf = _cache.indexOf; + starts = _cache.starts; + ends = _cache.ends; exports.BaseNode = (function() { BaseNode = function() { this.tags = {}; @@ -55,7 +55,7 @@ } else if (this instanceof ValueNode && options.assignment) { return this.cacheIndexes(o); } else { - reference = literal(o.scope.freeVariable()); + reference = literal(o.scope.freeVariable('cache')); compiled = new AssignNode(reference, this); return [compiled, reference]; } @@ -102,37 +102,37 @@ return this.traverseChildren(true, block); }; BaseNode.prototype.toString = function(idt, override) { - var _b, _c, _d, _e, child, children; + var _cache2, _cache3, _index, _result, child, children; idt || (idt = ''); children = (function() { - _b = []; _d = this.collectChildren(); - for (_c = 0, _e = _d.length; _c < _e; _c++) { - child = _d[_c]; - _b.push(child.toString(idt + TAB)); + _result = []; _cache2 = this.collectChildren(); + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + child = _cache2[_index]; + _result.push(child.toString(idt + TAB)); } - return _b; + return _result; }).call(this).join(''); return '\n' + idt + (override || this["class"]) + children; }; BaseNode.prototype.eachChild = function(func) { - var _b, _c, _d, _e, _f, _g, _h, attr, child; + var _cache2, _cache3, _cache4, _cache5, _index, _index2, _result, attr, child; if (!(this.children)) { return null; } - _b = []; _d = this.children; - for (_c = 0, _e = _d.length; _c < _e; _c++) { - attr = _d[_c]; + _result = []; _cache2 = this.children; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + attr = _cache2[_index]; if (this[attr]) { - _g = flatten([this[attr]]); - for (_f = 0, _h = _g.length; _f < _h; _f++) { - child = _g[_f]; + _cache4 = flatten([this[attr]]); + for (_index2 = 0, _cache5 = _cache4.length; _index2 < _cache5; _index2++) { + child = _cache4[_index2]; if (func(child) === false) { return null; } } } } - return _b; + return _result; }; BaseNode.prototype.collectChildren = function() { var nodes; @@ -210,14 +210,14 @@ return o.scope ? Expressions.__super__.compile.call(this, o) : this.compileRoot(o); }; Expressions.prototype.compileNode = function(o) { - var _b, _c, _d, _e, node; + var _cache2, _cache3, _index, _result, node; return (function() { - _b = []; _d = this.expressions; - for (_c = 0, _e = _d.length; _c < _e; _c++) { - node = _d[_c]; - _b.push(this.compileExpression(node, merge(o))); + _result = []; _cache2 = this.expressions; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + node = _cache2[_index]; + _result.push(this.compileExpression(node, merge(o))); } - return _b; + return _result; }).call(this).join("\n"); }; Expressions.prototype.compileRoot = function(o) { @@ -256,8 +256,8 @@ return new Expressions(nodes); }; exports.LiteralNode = (function() { - LiteralNode = function(_b) { - this.value = _b; + LiteralNode = function(_arg) { + this.value = _arg; LiteralNode.__super__.constructor.call(this); return this; }; @@ -282,8 +282,8 @@ return LiteralNode; })(); exports.ReturnNode = (function() { - ReturnNode = function(_b) { - this.expression = _b; + ReturnNode = function(_arg) { + this.expression = _arg; ReturnNode.__super__.constructor.call(this); return this; }; @@ -316,9 +316,9 @@ return ReturnNode; })(); exports.ValueNode = (function() { - ValueNode = function(_b, _c) { - this.properties = _c; - this.base = _b; + ValueNode = function(_arg, _arg2) { + this.properties = _arg2; + this.base = _arg; ValueNode.__super__.constructor.call(this); this.properties || (this.properties = []); return this; @@ -355,25 +355,25 @@ return this.base instanceof LiteralNode && this.base.value.match(NUMBER); }; ValueNode.prototype.cacheIndexes = function(o) { - var _b, _c, _d, _e, copy, i; + var _cache2, _cache3, _cache4, _index, copy, i; copy = new ValueNode(this.base, this.properties.slice(0)); if (this.base instanceof CallNode) { - _b = this.base.compileReference(o); - this.base = _b[0]; - copy.base = _b[1]; + _cache2 = this.base.compileReference(o); + this.base = _cache2[0]; + copy.base = _cache2[1]; } - _d = copy.properties; - for (_c = 0, _e = _d.length; _c < _e; _c++) { + _cache3 = copy.properties; + for (_index = 0, _cache4 = _cache3.length; _index < _cache4; _index++) { (function() { - var _f, index, indexVar; - var i = _c; - var prop = _d[_c]; + var _cache5, index, indexVar; + var i = _index; + var prop = _cache3[_index]; if (prop instanceof IndexNode && prop.contains(function(n) { return n instanceof CallNode; })) { - _f = prop.index.compileReference(o); - index = _f[0]; - indexVar = _f[1]; + _cache5 = prop.index.compileReference(o); + index = _cache5[0]; + indexVar = _cache5[1]; this.properties[i] = new IndexNode(index); return (copy.properties[i] = new IndexNode(indexVar)); } @@ -385,22 +385,22 @@ return !o.top || this.properties.length ? ValueNode.__super__.compile.call(this, o) : this.base.compile(o); }; ValueNode.prototype.compileNode = function(o) { - var _b, _c, _d, _e, _f, _g, baseline, complete, copy, hasSoak, i, me, only, op, part, prop, props, temp; + var _cache2, _cache3, _cache4, _cache5, _cache6, _index, baseline, complete, copy, hasSoak, i, me, only, op, part, prop, props, temp; only = del(o, 'onlyFirst'); op = this.tags.operation; props = only ? this.properties.slice(0, this.properties.length - 1) : this.properties; o.chainRoot || (o.chainRoot = this); - _c = props; - for (_b = 0, _d = _c.length; _b < _d; _b++) { - prop = _c[_b]; + _cache2 = props; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + prop = _cache2[_index]; if (prop.soakNode) { hasSoak = true; } } if (hasSoak && this.containsType(CallNode)) { - _e = this.cacheIndexes(o); - me = _e[0]; - copy = _e[1]; + _cache4 = this.cacheIndexes(o); + me = _cache4[0]; + copy = _cache4[1]; } if (this.parenthetical && !props.length) { this.base.parenthetical = true; @@ -410,13 +410,13 @@ baseline = ("(" + (baseline) + ")"); } complete = (this.last = baseline); - _f = props; - for (i = 0, _g = _f.length; i < _g; i++) { - prop = _f[i]; + _cache5 = props; + for (i = 0, _cache6 = _cache5.length; i < _cache6; i++) { + prop = _cache5[i]; this.source = baseline; if (prop.soakNode) { if (this.base.containsType(CallNode) && i === 0) { - temp = o.scope.freeVariable(); + temp = o.scope.freeVariable('cache'); complete = ("(" + (baseline = temp) + " = (" + (complete) + "))"); } complete = i === 0 ? ("(typeof " + (complete) + " === \"undefined\" || " + (baseline) + " === null) ? undefined : ") : ("" + (complete) + " == null ? undefined : "); @@ -437,8 +437,8 @@ return ValueNode; })(); exports.CommentNode = (function() { - CommentNode = function(_b) { - this.comment = _b; + CommentNode = function(_arg) { + this.comment = _arg; CommentNode.__super__.constructor.call(this); return this; }; @@ -456,9 +456,9 @@ return CommentNode; })(); exports.CallNode = (function() { - CallNode = function(variable, _b, _c) { - this.exist = _c; - this.args = _b; + CallNode = function(variable, _arg, _arg2) { + this.exist = _arg2; + this.args = _arg; CallNode.__super__.constructor.call(this); this.isNew = false; this.isSuper = variable === 'super'; @@ -497,7 +497,7 @@ })()); }; CallNode.prototype.compileNode = function(o) { - var _b, _c, _d, _e, _f, _g, _h, _i, _j, arg, args, code, first, meth, methodAccessor, op; + var _cache2, _cache3, _cache4, _cache5, _cache6, _cache7, _index, _index2, _result, arg, args, code, first, meth, methodAccessor, op; if (!(o.chainRoot)) { o.chainRoot = this; } @@ -505,41 +505,41 @@ if (this.exist) { if (this.variable instanceof ValueNode && this.variable.properties[this.variable.properties.length - 1] instanceof AccessorNode) { methodAccessor = this.variable.properties.pop(); - _b = this.variable.compileReference(o); - first = _b[0]; - meth = _b[1]; + _cache2 = this.variable.compileReference(o); + first = _cache2[0]; + meth = _cache2[1]; this.first = new ValueNode(first, [methodAccessor]).compile(o); this.meth = new ValueNode(meth, [methodAccessor]).compile(o); } else { - _c = this.variable.compileReference(o, { + _cache3 = this.variable.compileReference(o, { precompile: true }); - this.first = _c[0]; - this.meth = _c[1]; + this.first = _cache3[0]; + this.meth = _cache3[1]; } this.first = ("(typeof " + (this.first) + " === \"function\" ? "); this.last = " : undefined)"; } else if (this.variable) { this.meth = this.variable.compile(o); } - _e = this.args; - for (_d = 0, _f = _e.length; _d < _f; _d++) { - arg = _e[_d]; + _cache4 = this.args; + for (_index = 0, _cache5 = _cache4.length; _index < _cache5; _index++) { + arg = _cache4[_index]; if (arg instanceof SplatNode) { code = this.compileSplat(o); } } if (!code) { args = (function() { - _g = []; _i = this.args; - for (_h = 0, _j = _i.length; _h < _j; _h++) { - arg = _i[_h]; - _g.push((function() { + _result = []; _cache6 = this.args; + for (_index2 = 0, _cache7 = _cache6.length; _index2 < _cache7; _index2++) { + arg = _cache6[_index2]; + _result.push((function() { arg.parenthetical = true; return arg.compile(o); })()); } - return _g; + return _result; }).call(this); code = this.isSuper ? this.compileSuper(args.join(', '), o) : ("" + (this.first) + (this.prefix()) + (this.meth) + "(" + (args.join(', ')) + ")" + (this.last)); } @@ -549,30 +549,30 @@ return "" + (this.superReference(o)) + ".call(this" + (args.length ? ', ' : '') + (args) + ")"; }; CallNode.prototype.compileSplat = function(o) { - var _b, _c, _d, a, b, c, mentionsArgs, meth, obj, temp; + var _cache2, _cache3, _index, a, b, c, mentionsArgs, meth, obj, temp; meth = this.meth || this.superReference(o); obj = this.variable && this.variable.source || 'this'; if (obj.match(/\(/)) { - temp = o.scope.freeVariable(); + temp = o.scope.freeVariable('cache'); obj = temp; meth = ("(" + (temp) + " = " + (this.variable.source) + ")" + (this.variable.last)); } if (this.isNew) { mentionsArgs = false; - _c = this.args; - for (_b = 0, _d = _c.length; _b < _d; _b++) { + _cache2 = this.args; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { (function() { - var arg = _c[_b]; + var arg = _cache2[_index]; return arg.contains(function(n) { return mentionsArgs || (mentionsArgs = (n instanceof LiteralNode && (n.value === 'arguments'))); }); })(); } utility('extends'); - a = o.scope.freeVariable(); - b = o.scope.freeVariable(); - c = o.scope.freeVariable(); - return "" + (this.first) + "(function() {\n" + (this.idt(1)) + "var ctor = function(){};\n" + (this.idt(1)) + "__extends(ctor, " + (a) + " = " + (meth) + ");\n" + (this.idt(1)) + "return typeof (" + (b) + " = " + (a) + ".apply(" + (c) + " = new ctor, " + (this.compileSplatArguments(o)) + ")) === \"object\" ? " + (b) + " : " + (c) + ";\n" + (this.tab) + "})." + (mentionsArgs ? 'apply(this, arguments)' : 'call(this)') + (this.last); + a = o.scope.freeVariable('klass'); + b = o.scope.freeVariable('cache'); + c = o.scope.freeVariable('cache'); + return "" + (this.first) + "(function() {\n" + (this.idt(1)) + "var ctor = function(){};\n" + (this.idt(1)) + "__extends(ctor, " + (a) + " = " + (meth) + ");\n" + (this.idt(1)) + "return typeof (" + (c) + " = " + (a) + ".apply(" + (b) + " = new ctor, " + (this.compileSplatArguments(o)) + ")) === \"object\" ? " + (c) + " : " + (b) + ";\n" + (this.tab) + "})." + (mentionsArgs ? 'apply(this, arguments)' : 'call(this)') + (this.last); } else { return "" + (this.first) + (this.prefix()) + (meth) + ".apply(" + (obj) + ", " + (this.compileSplatArguments(o)) + ")" + (this.last); } @@ -580,9 +580,9 @@ return CallNode; })(); exports.ExtendsNode = (function() { - ExtendsNode = function(_b, _c) { - this.parent = _c; - this.child = _b; + ExtendsNode = function(_arg, _arg2) { + this.parent = _arg2; + this.child = _arg; ExtendsNode.__super__.constructor.call(this); return this; }; @@ -597,8 +597,8 @@ return ExtendsNode; })(); exports.AccessorNode = (function() { - AccessorNode = function(_b, tag) { - this.name = _b; + AccessorNode = function(_arg, tag) { + this.name = _arg; AccessorNode.__super__.constructor.call(this); this.prototype = tag === 'prototype' ? '.prototype' : ''; this.soakNode = tag === 'soak'; @@ -617,8 +617,8 @@ return AccessorNode; })(); exports.IndexNode = (function() { - IndexNode = function(_b) { - this.index = _b; + IndexNode = function(_arg) { + this.index = _arg; IndexNode.__super__.constructor.call(this); return this; }; @@ -635,9 +635,9 @@ return IndexNode; })(); exports.RangeNode = (function() { - RangeNode = function(_b, _c, tag) { - this.to = _c; - this.from = _b; + RangeNode = function(_arg, _arg2, tag) { + this.to = _arg2; + this.from = _arg; RangeNode.__super__.constructor.call(this); this.exclusive = tag === 'exclusive'; this.equals = this.exclusive ? '' : '='; @@ -647,23 +647,23 @@ RangeNode.prototype["class"] = 'RangeNode'; RangeNode.prototype.children = ['from', 'to']; RangeNode.prototype.compileVariables = function(o) { - var _b, _c, _d, parts; + var _cache2, _cache3, _cache4, parts; o = merge(o, { top: true }); - _b = this.from.compileReference(o, { + _cache2 = this.from.compileReference(o, { precompile: true }); - this.from = _b[0]; - this.fromVar = _b[1]; - _c = this.to.compileReference(o, { + this.from = _cache2[0]; + this.fromVar = _cache2[1]; + _cache3 = this.to.compileReference(o, { precompile: true }); - this.to = _c[0]; - this.toVar = _c[1]; - _d = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)]; - this.fromNum = _d[0]; - this.toNum = _d[1]; + this.to = _cache3[0]; + this.toVar = _cache3[1]; + _cache4 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)]; + this.fromNum = _cache4[0]; + this.toNum = _cache4[1]; parts = []; if (this.from !== this.fromVar) { parts.push(this.from); @@ -691,34 +691,34 @@ return "" + (vars) + "; " + (compare) + "; " + (incr); }; RangeNode.prototype.compileSimple = function(o) { - var _b, from, idx, step, to; - _b = [parseInt(this.fromNum, 10), parseInt(this.toNum, 10)]; - from = _b[0]; - to = _b[1]; + var _cache2, from, idx, step, to; + _cache2 = [parseInt(this.fromNum, 10), parseInt(this.toNum, 10)]; + from = _cache2[0]; + to = _cache2[1]; idx = del(o, 'index'); step = del(o, 'step'); step && (step = ("" + (idx) + " += " + (step.compile(o)))); return from <= to ? ("" + (idx) + " = " + (from) + "; " + (idx) + " <" + (this.equals) + " " + (to) + "; " + (step || ("" + (idx) + "++"))) : ("" + (idx) + " = " + (from) + "; " + (idx) + " >" + (this.equals) + " " + (to) + "; " + (step || ("" + (idx) + "--"))); }; RangeNode.prototype.compileArray = function(o) { - var _b, _c, body, clause, i, idt, post, pre, range, result, vars; + var _index, _result, body, clause, i, idt, post, pre, range, result, vars; idt = this.idt(1); vars = this.compileVariables(merge(o, { indent: idt })); if (this.fromNum && this.toNum && (Math.abs(+this.fromNum - +this.toNum) <= 20)) { range = (function() { - _c = []; - for (var _b = +this.fromNum; +this.fromNum <= +this.toNum ? _b <= +this.toNum : _b >= +this.toNum; +this.fromNum <= +this.toNum ? _b += 1 : _b -= 1){ _c.push(_b); } - return _c; + _result = []; + for (var _index = +this.fromNum; +this.fromNum <= +this.toNum ? _index <= +this.toNum : _index >= +this.toNum; +this.fromNum <= +this.toNum ? _index += 1 : _index -= 1){ _result.push(_index); } + return _result; }).call(this); if (this.exclusive) { range.pop(); } return ("[" + (range.join(', ')) + "]"); } - i = o.scope.freeVariable(); - result = o.scope.freeVariable(); + i = o.scope.freeVariable('index'); + result = o.scope.freeVariable('result'); pre = ("\n" + (idt) + (result) + " = []; " + (vars)); if (this.fromNum && this.toNum) { o.index = i; @@ -733,8 +733,8 @@ return RangeNode; })(); exports.SliceNode = (function() { - SliceNode = function(_b) { - this.range = _b; + SliceNode = function(_arg) { + this.range = _arg; SliceNode.__super__.constructor.call(this); return this; }; @@ -766,25 +766,25 @@ return true; }; ObjectNode.prototype.compileNode = function(o) { - var _b, _c, _d, _e, _f, _g, _h, i, indent, join, lastNoncom, nonComments, obj, prop, props, top; + var _cache2, _cache3, _cache4, _cache5, _index, _result, _result2, i, indent, join, lastNoncom, nonComments, obj, prop, props, top; top = del(o, 'top'); o.indent = this.idt(1); nonComments = (function() { - _b = []; _d = this.properties; - for (_c = 0, _e = _d.length; _c < _e; _c++) { - prop = _d[_c]; + _result = []; _cache2 = this.properties; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + prop = _cache2[_index]; if (!(prop instanceof CommentNode)) { - _b.push(prop); + _result.push(prop); } } - return _b; + return _result; }).call(this); lastNoncom = nonComments[nonComments.length - 1]; props = (function() { - _f = []; _g = this.properties; - for (i = 0, _h = _g.length; i < _h; i++) { - prop = _g[i]; - _f.push((function() { + _result2 = []; _cache4 = this.properties; + for (i = 0, _cache5 = _cache4.length; i < _cache5; i++) { + prop = _cache4[i]; + _result2.push((function() { join = ",\n"; if ((prop === lastNoncom) || (prop instanceof CommentNode)) { join = "\n"; @@ -799,7 +799,7 @@ return indent + prop.compile(o) + join; }).call(this)); } - return _f; + return _result2; }).call(this); props = props.join(''); obj = '{' + (props ? '\n' + props + '\n' + this.idt() : '') + '}'; @@ -808,8 +808,8 @@ return ObjectNode; })(); exports.ArrayNode = (function() { - ArrayNode = function(_b) { - this.objects = _b; + ArrayNode = function(_arg) { + this.objects = _arg; ArrayNode.__super__.constructor.call(this); this.objects || (this.objects = []); this.compileSplatLiteral = function(o) { @@ -821,12 +821,12 @@ ArrayNode.prototype["class"] = 'ArrayNode'; ArrayNode.prototype.children = ['objects']; ArrayNode.prototype.compileNode = function(o) { - var _b, _c, code, i, obj, objects; + var _cache2, _cache3, code, i, obj, objects; o.indent = this.idt(1); objects = []; - _b = this.objects; - for (i = 0, _c = _b.length; i < _c; i++) { - obj = _b[i]; + _cache2 = this.objects; + for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) { + obj = _cache2[i]; code = obj.compile(o); if (obj instanceof SplatNode) { return this.compileSplatLiteral(o); @@ -844,10 +844,10 @@ return ArrayNode; })(); exports.ClassNode = (function() { - ClassNode = function(_b, _c, _d) { - this.properties = _d; - this.parent = _c; - this.variable = _b; + ClassNode = function(_arg, _arg2, _arg3) { + this.properties = _arg3; + this.parent = _arg2; + this.variable = _arg; ClassNode.__super__.constructor.call(this); this.properties || (this.properties = []); this.returns = false; @@ -864,9 +864,9 @@ return this; }; ClassNode.prototype.compileNode = function(o) { - var _b, _c, _d, _e, access, applied, className, constScope, construct, constructor, extension, func, me, pname, prop, props, pvar, returns, val; + var _cache2, _cache3, _cache4, _index, access, applied, className, constScope, construct, constructor, extension, func, me, pname, prop, props, pvar, returns, val; if (this.variable === '__temp__') { - this.variable = literal(o.scope.freeVariable()); + this.variable = literal(o.scope.freeVariable('klass')); } extension = this.parent && new ExtendsNode(this.variable, this.parent); props = new Expressions(); @@ -880,12 +880,12 @@ } else { constructor = new CodeNode(); } - _c = this.properties; - for (_b = 0, _d = _c.length; _b < _d; _b++) { - prop = _c[_b]; - _e = [prop.variable, prop.value]; - pvar = _e[0]; - func = _e[1]; + _cache2 = this.properties; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + prop = _cache2[_index]; + _cache4 = [prop.variable, prop.value]; + pvar = _cache4[0]; + func = _cache4[1]; if (pvar && pvar.base.value === 'constructor' && func instanceof CodeNode) { if (func.bound) { throw new Error("cannot define a constructor as a bound function."); @@ -903,7 +903,7 @@ } else { func.bound = false; constScope || (constScope = new Scope(o.scope, constructor.body, constructor)); - me || (me = constScope.freeVariable()); + me || (me = constScope.freeVariable('self')); pname = pvar.compile(o); if (constructor.body.empty()) { constructor.body.push(new ReturnNode(literal('this'))); @@ -932,10 +932,10 @@ return ClassNode; })(); exports.AssignNode = (function() { - AssignNode = function(_b, _c, _d) { - this.context = _d; - this.value = _c; - this.variable = _b; + AssignNode = function(_arg, _arg2, _arg3) { + this.context = _arg3; + this.value = _arg2; + this.variable = _arg; AssignNode.__super__.constructor.call(this); return this; }; @@ -996,22 +996,22 @@ return top || this.parenthetical ? val : ("(" + (val) + ")"); }; AssignNode.prototype.compilePatternMatch = function(o) { - var _b, _c, _d, accessClass, assigns, code, i, idx, isString, obj, oindex, olength, splat, val, valVar, value; - valVar = o.scope.freeVariable(); + var _cache2, _cache3, _cache4, accessClass, assigns, code, i, idx, isString, obj, oindex, olength, splat, val, valVar, value; + valVar = o.scope.freeVariable('cache'); value = this.value.isStatement(o) ? ClosureNode.wrap(this.value) : this.value; assigns = [("" + (this.tab) + (valVar) + " = " + (value.compile(o)) + ";")]; o.top = true; o.asStatement = true; splat = false; - _b = this.variable.base.objects; - for (i = 0, _c = _b.length; i < _c; i++) { - obj = _b[i]; + _cache2 = this.variable.base.objects; + for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) { + obj = _cache2[i]; idx = i; if (this.variable.isObject()) { if (obj instanceof AssignNode) { - _d = [obj.value, obj.variable.base]; - obj = _d[0]; - idx = _d[1]; + _cache4 = [obj.value, obj.variable.base]; + obj = _cache4[0]; + idx = _cache4[1]; } else { idx = obj; } @@ -1051,9 +1051,9 @@ return AssignNode; })(); exports.CodeNode = (function() { - CodeNode = function(_b, _c, tag) { - this.body = _c; - this.params = _b; + CodeNode = function(_arg, _arg2, tag) { + this.body = _arg2; + this.params = _arg; CodeNode.__super__.constructor.call(this); this.params || (this.params = []); this.body || (this.body = new Expressions()); @@ -1067,7 +1067,7 @@ CodeNode.prototype["class"] = 'CodeNode'; CodeNode.prototype.children = ['params', 'body']; CodeNode.prototype.compileNode = function(o) { - var _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, code, empty, func, i, param, params, sharedScope, splat, top, value; + var _cache2, _cache3, _cache4, _cache5, _cache6, _cache7, _cache8, _cache9, _index, _index2, _result, code, empty, func, i, param, params, sharedScope, splat, top, value; sharedScope = del(o, 'sharedScope'); top = del(o, 'top'); o.scope = sharedScope || new Scope(o.scope, this.body, this); @@ -1078,9 +1078,9 @@ del(o, 'globals'); splat = undefined; params = []; - _b = this.params; - for (i = 0, _c = _b.length; i < _c; i++) { - param = _b[i]; + _cache2 = this.params; + for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) { + param = _cache2[i]; if (splat) { if (param.attach) { param.assign = new AssignNode(new ValueNode(literal('this'), [new AccessorNode(param.value)])); @@ -1089,11 +1089,11 @@ splat.trailings.push(param); } else { if (param.attach) { - _d = param; - value = _d.value; - _e = [literal(o.scope.freeVariable()), param.splat]; - param = _e[0]; - param.splat = _e[1]; + _cache4 = param; + value = _cache4.value; + _cache5 = [literal(o.scope.freeVariable('arg')), param.splat]; + param = _cache5[0]; + param.splat = _cache5[1]; this.body.unshift(new AssignNode(new ValueNode(literal('this'), [new AccessorNode(value)]), param)); } if (param.splat) { @@ -1108,19 +1108,19 @@ } } params = (function() { - _f = []; _h = params; - for (_g = 0, _i = _h.length; _g < _i; _g++) { - param = _h[_g]; - _f.push(param.compile(o)); + _result = []; _cache6 = params; + for (_index = 0, _cache7 = _cache6.length; _index < _cache7; _index++) { + param = _cache6[_index]; + _result.push(param.compile(o)); } - return _f; + return _result; })(); if (!(empty)) { this.body.makeReturn(); } - _k = params; - for (_j = 0, _l = _k.length; _j < _l; _j++) { - param = _k[_j]; + _cache8 = params; + for (_index2 = 0, _cache9 = _cache8.length; _index2 < _cache9; _index2++) { + param = _cache8[_index2]; (o.scope.parameter(param)); } code = this.body.expressions.length ? ("\n" + (this.body.compileWithDeclarations(o)) + "\n") : ''; @@ -1139,25 +1139,25 @@ } }; CodeNode.prototype.toString = function(idt) { - var _b, _c, _d, _e, child, children; + var _cache2, _cache3, _index, _result, child, children; idt || (idt = ''); children = (function() { - _b = []; _d = this.collectChildren(); - for (_c = 0, _e = _d.length; _c < _e; _c++) { - child = _d[_c]; - _b.push(child.toString(idt + TAB)); + _result = []; _cache2 = this.collectChildren(); + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + child = _cache2[_index]; + _result.push(child.toString(idt + TAB)); } - return _b; + return _result; }).call(this).join(''); return '\n' + idt + children; }; return CodeNode; })(); exports.ParamNode = (function() { - ParamNode = function(_b, _c, _d) { - this.splat = _d; - this.attach = _c; - this.name = _b; + ParamNode = function(_arg, _arg2, _arg3) { + this.splat = _arg3; + this.attach = _arg2; + this.name = _arg; ParamNode.__super__.constructor.call(this); this.value = literal(this.name); return this; @@ -1186,26 +1186,26 @@ SplatNode.prototype["class"] = 'SplatNode'; SplatNode.prototype.children = ['name']; SplatNode.prototype.compileNode = function(o) { - var _b; - return (typeof (_b = this.index) !== "undefined" && _b !== null) ? this.compileParam(o) : this.name.compile(o); + var _cache2; + return (typeof (_cache2 = this.index) !== "undefined" && _cache2 !== null) ? this.compileParam(o) : this.name.compile(o); }; SplatNode.prototype.compileParam = function(o) { - var _b, _c, assign, end, idx, len, name, pos, trailing, variadic; + var _cache2, _cache3, assign, end, idx, len, name, pos, trailing, variadic; name = this.name.compile(o); o.scope.find(name); end = ''; if (this.trailings.length) { - len = o.scope.freeVariable(); + len = o.scope.freeVariable('cache'); o.scope.assign(len, "arguments.length"); - variadic = o.scope.freeVariable(); + variadic = o.scope.freeVariable('result'); o.scope.assign(variadic, len + ' >= ' + this.arglength); end = this.trailings.length ? (", " + (len) + " - " + (this.trailings.length)) : null; - _b = this.trailings; - for (idx = 0, _c = _b.length; idx < _c; idx++) { - trailing = _b[idx]; + _cache2 = this.trailings; + for (idx = 0, _cache3 = _cache2.length; idx < _cache3; idx++) { + trailing = _cache2[idx]; if (trailing.attach) { assign = trailing.assign; - trailing = literal(o.scope.freeVariable()); + trailing = literal(o.scope.freeVariable('arg')); assign.value = trailing; } pos = this.trailings.length - idx; @@ -1220,11 +1220,11 @@ return "" + (utility('slice')) + ".call(" + (name) + ", " + (index) + (trail) + ")"; }; SplatNode.compileSplattedArray = function(list, o) { - var _b, _c, arg, args, code, i, last, prev; + var _cache2, _cache3, arg, args, code, i, last, prev; args = []; - _b = list; - for (i = 0, _c = _b.length; i < _c; i++) { - arg = _b[i]; + _cache2 = list; + for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) { + arg = _cache2[i]; code = arg.compile(o); prev = args[(last = args.length - 1)]; if (!(arg instanceof SplatNode)) { @@ -1283,7 +1283,7 @@ cond = this.condition.compile(o); set = ''; if (!(top)) { - rvar = o.scope.freeVariable(); + rvar = o.scope.freeVariable('result'); set = ("" + (this.tab) + (rvar) + " = [];\n"); if (this.body) { this.body = PushNode.wrap(rvar, this.body); @@ -1305,10 +1305,10 @@ return WhileNode; })(); exports.OpNode = (function() { - OpNode = function(_b, _c, _d, flip) { - this.second = _d; - this.first = _c; - this.operator = _b; + OpNode = function(_arg, _arg2, _arg3, flip) { + this.second = _arg3; + this.first = _arg2; + this.operator = _arg; OpNode.__super__.constructor.call(this); this.operator = this.CONVERSIONS[this.operator] || this.operator; this.flip = !!flip; @@ -1339,12 +1339,12 @@ return !this.second; }; OpNode.prototype.isInvertible = function() { - var _b; - return (('===' === (_b = this.operator) || '!==' === _b)) && !(this.first instanceof OpNode) && !(this.second instanceof OpNode); + var _cache2; + return (('===' === (_cache2 = this.operator) || '!==' === _cache2)) && !(this.first instanceof OpNode) && !(this.second instanceof OpNode); }; OpNode.prototype.isMutator = function() { - var _b; - return ends(this.operator, '=') && !(('===' === (_b = this.operator) || '!==' === _b)); + var _cache2; + return ends(this.operator, '=') && !(('===' === (_cache2 = this.operator) || '!==' === _cache2)); }; OpNode.prototype.isChainable = function() { return include(this.CHAINABLE, this.operator); @@ -1377,27 +1377,27 @@ return [this.first.compile(o), this.operator, this.second.compile(o)].join(' '); }; OpNode.prototype.compileChain = function(o) { - var _b, _c, first, second, shared; + var _cache2, _cache3, first, second, shared; shared = this.first.unwrap().second; if (shared.containsType(CallNode)) { - _b = shared.compileReference(o); - this.first.second = _b[0]; - shared = _b[1]; + _cache2 = shared.compileReference(o); + this.first.second = _cache2[0]; + shared = _cache2[1]; } - _c = [this.first.compile(o), this.second.compile(o), shared.compile(o)]; - first = _c[0]; - second = _c[1]; - shared = _c[2]; + _cache3 = [this.first.compile(o), this.second.compile(o), shared.compile(o)]; + first = _cache3[0]; + second = _cache3[1]; + shared = _cache3[2]; return "(" + (first) + ") && (" + (shared) + " " + (this.operator) + " " + (second) + ")"; }; OpNode.prototype.compileAssignment = function(o) { - var _b, first, firstVar, second; - _b = this.first.compileReference(o, { + var _cache2, first, firstVar, second; + _cache2 = this.first.compileReference(o, { precompile: true, assignment: true }); - first = _b[0]; - firstVar = _b[1]; + first = _cache2[0]; + firstVar = _cache2[1]; second = this.second.compile(o); if (this.second instanceof OpNode) { second = ("(" + (second) + ")"); @@ -1411,10 +1411,10 @@ return "" + (first) + " " + (this.operator.substr(0, 2)) + " (" + (firstVar) + " = " + (second) + ")"; }; OpNode.prototype.compileExistence = function(o) { - var _b, ref, test; - _b = ExistenceNode.compileTest(o, this.first); - test = _b[0]; - ref = _b[1]; + var _cache2, ref, test; + _cache2 = ExistenceNode.compileTest(o, this.first); + test = _cache2[0]; + ref = _cache2[1]; return "" + (test) + " ? " + (ref) + " : " + (this.second.compile(o)); }; OpNode.prototype.compileUnary = function(o) { @@ -1429,9 +1429,9 @@ return OpNode; })(); exports.InNode = (function() { - InNode = function(_b, _c) { - this.array = _c; - this.object = _b; + InNode = function(_arg, _arg2) { + this.array = _arg2; + this.object = _arg; InNode.__super__.constructor.call(this); return this; }; @@ -1442,47 +1442,47 @@ return this.array instanceof ValueNode && this.array.isArray(); }; InNode.prototype.compileNode = function(o) { - var _b; - _b = this.object.compileReference(o, { + var _cache2; + _cache2 = this.object.compileReference(o, { precompile: true }); - this.obj1 = _b[0]; - this.obj2 = _b[1]; + this.obj1 = _cache2[0]; + this.obj2 = _cache2[1]; return this.isArray() ? this.compileOrTest(o) : this.compileLoopTest(o); }; InNode.prototype.compileOrTest = function(o) { - var _b, _c, _d, i, item, tests; + var _cache2, _cache3, _result, i, item, tests; tests = (function() { - _b = []; _c = this.array.base.objects; - for (i = 0, _d = _c.length; i < _d; i++) { - item = _c[i]; - _b.push("" + (item.compile(o)) + " === " + (i ? this.obj2 : this.obj1)); + _result = []; _cache2 = this.array.base.objects; + for (i = 0, _cache3 = _cache2.length; i < _cache3; i++) { + item = _cache2[i]; + _result.push("" + (item.compile(o)) + " === " + (i ? this.obj2 : this.obj1)); } - return _b; + return _result; }).call(this); return "(" + (tests.join(' || ')) + ")"; }; InNode.prototype.compileLoopTest = function(o) { - var _b, _c, i, l, prefix; - _b = this.array.compileReference(o, { + var _cache2, _cache3, i, l, prefix; + _cache2 = this.array.compileReference(o, { precompile: true }); - this.arr1 = _b[0]; - this.arr2 = _b[1]; - _c = [o.scope.freeVariable(), o.scope.freeVariable()]; - i = _c[0]; - l = _c[1]; + this.arr1 = _cache2[0]; + this.arr2 = _cache2[1]; + _cache3 = [o.scope.freeVariable('index'), o.scope.freeVariable('cache')]; + i = _cache3[0]; + l = _cache3[1]; prefix = this.obj1 !== this.obj2 ? this.obj1 + '; ' : ''; return "(function(){ " + (prefix) + "for (var " + (i) + "=0, " + (l) + "=" + (this.arr1) + ".length; " + (i) + "<" + (l) + "; " + (i) + "++) { if (" + (this.arr2) + "[" + (i) + "] === " + (this.obj2) + ") return true; } return false; }).call(this)"; }; return InNode; })(); exports.TryNode = (function() { - TryNode = function(_b, _c, _d, _e) { - this.ensure = _e; - this.recovery = _d; - this.error = _c; - this.attempt = _b; + TryNode = function(_arg, _arg2, _arg3, _arg4) { + this.ensure = _arg4; + this.recovery = _arg3; + this.error = _arg2; + this.attempt = _arg; TryNode.__super__.constructor.call(this); return this; }; @@ -1514,8 +1514,8 @@ return TryNode; })(); exports.ThrowNode = (function() { - ThrowNode = function(_b) { - this.expression = _b; + ThrowNode = function(_arg) { + this.expression = _arg; ThrowNode.__super__.constructor.call(this); return this; }; @@ -1534,8 +1534,8 @@ return ThrowNode; })(); exports.ExistenceNode = (function() { - ExistenceNode = function(_b) { - this.expression = _b; + ExistenceNode = function(_arg) { + this.expression = _arg; ExistenceNode.__super__.constructor.call(this); return this; }; @@ -1548,19 +1548,19 @@ return this.parenthetical ? test.substring(1, test.length - 1) : test; }; ExistenceNode.compileTest = function(o, variable) { - var _b, first, second; - _b = variable.compileReference(o, { + var _cache2, first, second; + _cache2 = variable.compileReference(o, { precompile: true }); - first = _b[0]; - second = _b[1]; + first = _cache2[0]; + second = _cache2[1]; return [("(typeof " + (first) + " !== \"undefined\" && " + (second) + " !== null)"), second]; }; return ExistenceNode; }).call(this); exports.ParentheticalNode = (function() { - ParentheticalNode = function(_b) { - this.expression = _b; + ParentheticalNode = function(_arg) { + this.expression = _arg; ParentheticalNode.__super__.constructor.call(this); return this; }; @@ -1592,11 +1592,11 @@ return ParentheticalNode; })(); exports.ForNode = (function() { - ForNode = function(_b, source, _c, _d) { - var _e; - this.index = _d; - this.name = _c; - this.body = _b; + ForNode = function(_arg, source, _arg2, _arg3) { + var _cache2; + this.index = _arg3; + this.name = _arg2; + this.body = _arg; ForNode.__super__.constructor.call(this); this.index || (this.index = null); this.source = source.source; @@ -1605,9 +1605,9 @@ this.raw = !!source.raw; this.object = !!source.object; if (this.object) { - _e = [this.index, this.name]; - this.name = _e[0]; - this.index = _e[1]; + _cache2 = [this.index, this.name]; + this.name = _cache2[0]; + this.index = _cache2[1]; } this.pattern = this.name instanceof ValueNode; if (this.index instanceof ValueNode) { @@ -1647,7 +1647,7 @@ return n instanceof CodeNode; }); scope = o.scope; - name = (this.name && this.name.compile(o)) || scope.freeVariable(); + name = (this.name && this.name.compile(o)) || scope.freeVariable('index'); index = this.index && this.index.compile(o); if (name && !this.pattern && (range || !codeInBody)) { scope.find(name, { @@ -1660,15 +1660,15 @@ }); } if (!(topLevel)) { - rvar = scope.freeVariable(); + rvar = scope.freeVariable('result'); } ivar = (function() { if (codeInBody) { - return scope.freeVariable(); + return scope.freeVariable('index'); } else if (range) { return name; } else { - return index || scope.freeVariable(); + return index || scope.freeVariable('index'); } })(); varPart = ''; @@ -1681,7 +1681,7 @@ step: this.step })); } else { - svar = scope.freeVariable(); + svar = scope.freeVariable('cache'); sourcePart = ("" + (svar) + " = " + (this.source.compile(o)) + ";"); if (this.pattern) { namePart = new AssignNode(this.name, literal("" + (svar) + "[" + (ivar) + "]")).compile(merge(o, { @@ -1694,7 +1694,7 @@ } } if (!(this.object)) { - lvar = scope.freeVariable(); + lvar = scope.freeVariable('cache'); stepPart = this.step ? ("" + (ivar) + " += " + (this.step.compile(o))) : ("" + (ivar) + "++"); forPart = ("" + (ivar) + " = 0, " + (lvar) + " = " + (svar) + ".length; " + (ivar) + " < " + (lvar) + "; " + (stepPart)); } @@ -1738,10 +1738,10 @@ return ForNode; })(); exports.SwitchNode = (function() { - SwitchNode = function(_b, _c, _d) { - this.otherwise = _d; - this.cases = _c; - this.subject = _b; + SwitchNode = function(_arg, _arg2, _arg3) { + this.otherwise = _arg3; + this.cases = _arg2; + this.subject = _arg; SwitchNode.__super__.constructor.call(this); this.tags.subjectless = !this.subject; this.subject || (this.subject = literal('true')); @@ -1754,10 +1754,10 @@ return true; }; SwitchNode.prototype.makeReturn = function() { - var _b, _c, _d, pair; - _c = this.cases; - for (_b = 0, _d = _c.length; _b < _d; _b++) { - pair = _c[_b]; + var _cache2, _cache3, _index, pair; + _cache2 = this.cases; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + pair = _cache2[_index]; pair[1].makeReturn(); } if (this.otherwise) { @@ -1766,20 +1766,20 @@ return this; }; SwitchNode.prototype.compileNode = function(o) { - var _b, _c, _d, _e, _f, _g, _h, block, code, condition, conditions, exprs, idt, pair; + var _cache2, _cache3, _cache4, _cache5, _cache6, _index, _index2, block, code, condition, conditions, exprs, idt, pair; idt = (o.indent = this.idt(1)); o.top = true; code = ("" + (this.tab) + "switch (" + (this.subject.compile(o)) + ") {"); - _c = this.cases; - for (_b = 0, _d = _c.length; _b < _d; _b++) { - pair = _c[_b]; - _e = pair; - conditions = _e[0]; - block = _e[1]; + _cache2 = this.cases; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + pair = _cache2[_index]; + _cache4 = pair; + conditions = _cache4[0]; + block = _cache4[1]; exprs = block.expressions; - _g = flatten([conditions]); - for (_f = 0, _h = _g.length; _f < _h; _f++) { - condition = _g[_f]; + _cache5 = flatten([conditions]); + for (_index2 = 0, _cache6 = _cache5.length; _index2 < _cache6; _index2++) { + condition = _cache5[_index2]; if (this.tags.subjectless) { condition = new OpNode('!!', new ParentheticalNode(condition)); } @@ -1799,10 +1799,10 @@ return SwitchNode; })(); exports.IfNode = (function() { - IfNode = function(_b, _c, _d) { - this.tags = _d; - this.body = _c; - this.condition = _b; + IfNode = function(_arg, _arg2, _arg3) { + this.tags = _arg3; + this.body = _arg2; + this.condition = _arg; this.tags || (this.tags = {}); if (this.tags.invert) { if (this.condition instanceof OpNode && this.condition.isInvertible()) { @@ -1844,18 +1844,18 @@ return this.statement || (this.statement = (!!((o && o.top) || this.tags.statement || this.bodyNode().isStatement(o) || (this.elseBody && this.elseBodyNode().isStatement(o))))); }; IfNode.prototype.compileCondition = function(o) { - var _b, _c, _d, _e, cond, conditions; + var _cache2, _cache3, _index, _result, cond, conditions; conditions = flatten([this.condition]); if (conditions.length === 1) { conditions[0].parenthetical = true; } return (function() { - _b = []; _d = conditions; - for (_c = 0, _e = _d.length; _c < _e; _c++) { - cond = _d[_c]; - _b.push(cond.compile(o)); + _result = []; _cache2 = conditions; + for (_index = 0, _cache3 = _cache2.length; _index < _cache3; _index++) { + cond = _cache2[_index]; + _result.push(cond.compile(o)); } - return _b; + return _result; })().join(' || '); }; IfNode.prototype.compileNode = function(o) { diff --git a/lib/optparse.js b/lib/optparse.js index 94eb6079..581fa70c 100755 --- a/lib/optparse.js +++ b/lib/optparse.js @@ -7,19 +7,19 @@ return this; }; OptionParser.prototype.parse = function(args) { - var _a, _b, _c, _d, _e, arg, i, isOption, matchedRule, options, rule, value; + var _cache, _cache2, _cache3, _cache4, _index, arg, i, isOption, matchedRule, options, rule, value; options = { arguments: [] }; args = normalizeArguments(args); - _a = args; - for (i = 0, _b = _a.length; i < _b; i++) { - arg = _a[i]; + _cache = args; + for (i = 0, _cache2 = _cache.length; i < _cache2; i++) { + arg = _cache[i]; isOption = !!(arg.match(LONG_FLAG) || arg.match(SHORT_FLAG)); matchedRule = false; - _d = this.rules; - for (_c = 0, _e = _d.length; _c < _e; _c++) { - rule = _d[_c]; + _cache3 = this.rules; + for (_index = 0, _cache4 = _cache3.length; _index < _cache4; _index++) { + rule = _cache3[_index]; if (rule.shortFlag === arg || rule.longFlag === arg) { value = rule.hasArgument ? args[i += 1] : true; options[rule.name] = rule.isList ? (options[rule.name] || []).concat(value) : value; @@ -38,21 +38,21 @@ return options; }; OptionParser.prototype.help = function() { - var _a, _b, _c, _d, i, letPart, lines, rule, spaces; + var _cache, _cache2, _index, _result, i, letPart, lines, rule, spaces; lines = ['Available options:']; if (this.banner) { lines.unshift("" + (this.banner) + "\n"); } - _b = this.rules; - for (_a = 0, _c = _b.length; _a < _c; _a++) { - rule = _b[_a]; + _cache = this.rules; + for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) { + rule = _cache[_index]; spaces = 15 - rule.longFlag.length; spaces = spaces > 0 ? (function() { - _d = []; + _result = []; for (i = 0; (0 <= spaces ? i <= spaces : i >= spaces); (0 <= spaces ? i += 1 : i -= 1)) { - _d.push(' '); + _result.push(' '); } - return _d; + return _result; })().join('') : ''; letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' '; lines.push(' ' + letPart + rule.longFlag + spaces + rule.description); @@ -66,18 +66,18 @@ MULTI_FLAG = /^-(\w{2,})/; OPTIONAL = /\[(\w+(\*?))\]/; buildRules = function(rules) { - var _a, _b, _c, _d, tuple; - _a = []; _c = rules; - for (_b = 0, _d = _c.length; _b < _d; _b++) { - tuple = _c[_b]; - _a.push((function() { + var _cache, _cache2, _index, _result, tuple; + _result = []; _cache = rules; + for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) { + tuple = _cache[_index]; + _result.push((function() { if (tuple.length < 3) { tuple.unshift(null); } return buildRule.apply(this, tuple); })()); } - return _a; + return _result; }; buildRule = function(shortFlag, longFlag, description, options) { var match; @@ -94,16 +94,16 @@ }; }; normalizeArguments = function(args) { - var _a, _b, _c, _d, _e, _f, arg, l, match, result; + var _cache, _cache2, _cache3, _cache4, _index, _index2, arg, l, match, result; args = args.slice(0); result = []; - _b = args; - for (_a = 0, _c = _b.length; _a < _c; _a++) { - arg = _b[_a]; + _cache = args; + for (_index = 0, _cache2 = _cache.length; _index < _cache2; _index++) { + arg = _cache[_index]; if (match = arg.match(MULTI_FLAG)) { - _e = match[1].split(''); - for (_d = 0, _f = _e.length; _d < _f; _d++) { - l = _e[_d]; + _cache3 = match[1].split(''); + for (_index2 = 0, _cache4 = _cache3.length; _index2 < _cache4; _index2++) { + l = _cache3[_index2]; result.push('-' + l); } } else { diff --git a/lib/rewriter.js b/lib/rewriter.js index 451e740c..c7d8be2c 100644 --- a/lib/rewriter.js +++ b/lib/rewriter.js @@ -1,15 +1,15 @@ (function() { - var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, LINEBREAKS, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, helpers, include, pair; + var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, LINEBREAKS, Rewriter, SINGLE_CLOSERS, SINGLE_LINERS, _cache, _cache2, _cache3, _cache4, _cache5, _cache6, _cache7, _cache8, _index, _index2, _index3, _result, _result2, helpers, include, pair; var __hasProp = Object.prototype.hasOwnProperty; if (typeof process !== "undefined" && process !== null) { - _a = require('./helpers'); - helpers = _a.helpers; + _cache = require('./helpers'); + helpers = _cache.helpers; } else { this.exports = this; helpers = this.helpers; } - _b = helpers; - include = _b.include; + _cache2 = helpers; + include = _cache2.include; exports.Rewriter = (function() { Rewriter = function() {}; Rewriter.prototype.rewrite = function(tokens) { @@ -62,15 +62,15 @@ }; Rewriter.prototype.adjustComments = function() { return this.scanTokens(function(token, i) { - var _c, _d, after, before, post, prev; + var _cache3, _cache4, after, before, post, prev; if (token[0] !== 'HERECOMMENT') { return 1; } - _c = [this.tokens[i - 2], this.tokens[i - 1], this.tokens[i + 1], this.tokens[i + 2]]; - before = _c[0]; - prev = _c[1]; - post = _c[2]; - after = _c[3]; + _cache3 = [this.tokens[i - 2], this.tokens[i - 1], this.tokens[i + 1], this.tokens[i + 2]]; + before = _cache3[0]; + prev = _cache3[1]; + post = _cache3[2]; + after = _cache3[3]; if (after && after[0] === 'INDENT') { this.tokens.splice(i + 2, 1); if (before && before[0] === 'OUTDENT' && post && (prev[0] === post[0]) && (post[0] === 'TERMINATOR')) { @@ -78,7 +78,7 @@ } else { this.tokens.splice(i, 0, after); } - } else if (prev && !('TERMINATOR' === (_d = prev[0]) || 'INDENT' === _d || 'OUTDENT' === _d)) { + } else if (prev && !('TERMINATOR' === (_cache4 = prev[0]) || 'INDENT' === _cache4 || 'OUTDENT' === _cache4)) { if (post && post[0] === 'TERMINATOR' && after && after[0] === 'OUTDENT') { this.tokens.splice.apply(this.tokens, [i + 2, 0].concat(this.tokens.splice(i, 2))); if (this.tokens[i + 2][0] !== 'TERMINATOR') { @@ -93,12 +93,12 @@ }); }; Rewriter.prototype.removeLeadingNewlines = function() { - var _c; - _c = []; + var _result; + _result = []; while (this.tokens[0] && this.tokens[0][0] === 'TERMINATOR') { - _c.push(this.tokens.shift()); + _result.push(this.tokens.shift()); } - return _c; + return _result; }; Rewriter.prototype.removeMidExpressionNewlines = function() { return this.scanTokens(function(token, i) { @@ -114,8 +114,8 @@ var action, condition; if (token[0] === 'CALL_START') { condition = function(token, i) { - var _c; - return ((')' === (_c = token[0]) || 'CALL_END' === _c)) || (token[0] === 'OUTDENT' && this.tokens[i - 1][0] === ')'); + var _cache3; + return ((')' === (_cache3 = token[0]) || 'CALL_END' === _cache3)) || (token[0] === 'OUTDENT' && this.tokens[i - 1][0] === ')'); }; action = function(token, i) { var idx; @@ -132,8 +132,8 @@ var action, condition; if (token[0] === 'INDEX_START') { condition = function(token, i) { - var _c; - return (']' === (_c = token[0]) || 'INDEX_END' === _c); + var _cache3; + return (']' === (_cache3 = token[0]) || 'INDEX_END' === _cache3); }; action = function(token, i) { return (token[0] = 'INDEX_END'); @@ -162,15 +162,15 @@ tok.generated = true; this.tokens.splice(idx, 0, tok); condition = function(token, i) { - var _c, _d, _e, one, three, two; - _c = this.tokens.slice(i + 1, i + 4); - one = _c[0]; - two = _c[1]; - three = _c[2]; + var _cache3, _cache4, _cache5, one, three, two; + _cache3 = this.tokens.slice(i + 1, i + 4); + one = _cache3[0]; + two = _cache3[1]; + three = _cache3[2]; if ((this.tag(i + 1) === 'HERECOMMENT' || this.tag(i - 1) === 'HERECOMMENT')) { return false; } - return ((('TERMINATOR' === (_d = token[0]) || 'OUTDENT' === _d)) && !((two && two[0] === ':') || (one && one[0] === '@' && three && three[0] === ':'))) || (token[0] === ',' && one && (!('IDENTIFIER' === (_e = one[0]) || 'STRING' === _e || '@' === _e || 'TERMINATOR' === _e || 'OUTDENT' === _e))); + return ((('TERMINATOR' === (_cache4 = token[0]) || 'OUTDENT' === _cache4)) && !((two && two[0] === ':') || (one && one[0] === '@' && three && three[0] === ':'))) || (token[0] === ',' && one && (!('IDENTIFIER' === (_cache5 = one[0]) || 'STRING' === _cache5 || '@' === _cache5 || 'TERMINATOR' === _cache5 || 'OUTDENT' === _cache5))); }; action = function(token, i) { return this.tokens.splice(i, 0, ['}', '}', token[2]]); @@ -185,7 +185,7 @@ var classLine; classLine = false; return this.scanTokens(function(token, i) { - var _c, action, callObject, condition, idx, next, prev, seenSingle; + var _cache3, action, callObject, condition, idx, next, prev, seenSingle; if (token[0] === 'CLASS') { classLine = true; } @@ -203,14 +203,14 @@ if (prev && !prev.spaced && token[0] === '?') { token.call = true; } - if (prev && (prev.spaced && (include(IMPLICIT_FUNC, prev[0]) || prev.call) && include(IMPLICIT_CALL, token[0]) && !(token[0] === 'UNARY' && (('IN' === (_c = this.tag(i + 1)) || 'OF' === _c || 'INSTANCEOF' === _c)))) || callObject) { + if (prev && (prev.spaced && (include(IMPLICIT_FUNC, prev[0]) || prev.call) && include(IMPLICIT_CALL, token[0]) && !(token[0] === 'UNARY' && (('IN' === (_cache3 = this.tag(i + 1)) || 'OF' === _cache3 || 'INSTANCEOF' === _cache3)))) || callObject) { this.tokens.splice(i, 0, ['CALL_START', '(', token[2]]); condition = function(token, i) { - var _c; + var _cache3; if (!seenSingle && token.fromThen) { return true; } - if (('IF' === (_c = token[0]) || 'ELSE' === _c || 'UNLESS' === _c || '->' === _c || '=>' === _c)) { + if (('IF' === (_cache3 = token[0]) || 'ELSE' === _cache3 || 'UNLESS' === _cache3 || '->' === _cache3 || '=>' === _cache3)) { seenSingle = true; } return (!token.generated && this.tokens[i - 1][0] !== ',' && include(IMPLICIT_END, token[0]) && !(token[0] === 'INDENT' && (include(IMPLICIT_BLOCK, this.tag(i - 1)) || this.tag(i - 2) === 'CLASS' || this.tag(i + 1) === '{'))) || token[0] === 'PROPERTY_ACCESS' && this.tag(i - 1) === 'OUTDENT'; @@ -230,7 +230,7 @@ }; Rewriter.prototype.addImplicitIndentation = function() { return this.scanTokens(function(token, i) { - var _c, action, condition, indent, outdent, starter; + var _cache3, action, condition, indent, outdent, starter; if (token[0] === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { this.tokens.splice.apply(this.tokens, [i, 0].concat(this.indentation(token))); return 2; @@ -241,9 +241,9 @@ } if (include(SINGLE_LINERS, token[0]) && this.tag(i + 1) !== 'INDENT' && !(token[0] === 'ELSE' && this.tag(i + 1) === 'IF')) { starter = token[0]; - _c = this.indentation(token); - indent = _c[0]; - outdent = _c[1]; + _cache3 = this.indentation(token); + indent = _cache3[0]; + outdent = _cache3[1]; if (starter === 'THEN') { indent.fromThen = true; } @@ -268,12 +268,12 @@ }; Rewriter.prototype.tagPostfixConditionals = function() { return this.scanTokens(function(token, i) { - var _c, action, condition, original; - if (('IF' === (_c = token[0]) || 'UNLESS' === _c)) { + var _cache3, action, condition, original; + if (('IF' === (_cache3 = token[0]) || 'UNLESS' === _cache3)) { original = token; condition = function(token, i) { - var _c; - return ('TERMINATOR' === (_c = token[0]) || 'INDENT' === _c); + var _cache3; + return ('TERMINATOR' === (_cache3 = token[0]) || 'INDENT' === _cache3); }; action = function(token, i) { if (token[0] !== 'INDENT') { @@ -287,17 +287,17 @@ }); }; Rewriter.prototype.ensureBalance = function(pairs) { - var _c, _d, key, levels, line, open, openLine, unclosed, value; + var _cache3, _result, key, levels, line, open, openLine, unclosed, value; levels = {}; openLine = {}; this.scanTokens(function(token, i) { - var _c, _d, _e, _f, close, open, pair; - _d = pairs; - for (_c = 0, _e = _d.length; _c < _e; _c++) { - pair = _d[_c]; - _f = pair; - open = _f[0]; - close = _f[1]; + var _cache3, _cache4, _cache5, _index, close, open, pair; + _cache3 = pairs; + for (_index = 0, _cache4 = _cache3.length; _index < _cache4; _index++) { + pair = _cache3[_index]; + _cache5 = pair; + open = _cache5[0]; + close = _cache5[1]; levels[open] || (levels[open] = 0); if (token[0] === open) { if (levels[open] === 0) { @@ -315,15 +315,15 @@ return 1; }); unclosed = (function() { - _c = []; _d = levels; - for (key in _d) { - if (!__hasProp.call(_d, key)) continue; - value = _d[key]; + _result = []; _cache3 = levels; + for (key in _cache3) { + if (!__hasProp.call(_cache3, key)) continue; + value = _cache3[key]; if (value > 0) { - _c.push(key); + _result.push(key); } } - return _c; + return _result; })(); if (unclosed.length) { open = unclosed[0]; @@ -332,13 +332,13 @@ } }; Rewriter.prototype.rewriteClosingParens = function() { - var _c, debt, key, stack, val; + var _cache3, debt, key, stack, val; stack = []; debt = {}; - _c = INVERSES; - for (key in _c) { - if (!__hasProp.call(_c, key)) continue; - val = _c[key]; + _cache3 = INVERSES; + for (key in _cache3) { + if (!__hasProp.call(_cache3, key)) continue; + val = _cache3[key]; (debt[key] = 0); } return this.scanTokens(function(token, i) { @@ -385,27 +385,27 @@ })(); BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['PARAM_START', 'PARAM_END'], ['CALL_START', 'CALL_END'], ['INDEX_START', 'INDEX_END']]; INVERSES = {}; - _d = BALANCED_PAIRS; - for (_c = 0, _e = _d.length; _c < _e; _c++) { - pair = _d[_c]; + _cache3 = BALANCED_PAIRS; + for (_index = 0, _cache4 = _cache3.length; _index < _cache4; _index++) { + pair = _cache3[_index]; INVERSES[pair[0]] = pair[1]; INVERSES[pair[1]] = pair[0]; } EXPRESSION_START = (function() { - _f = []; _h = BALANCED_PAIRS; - for (_g = 0, _i = _h.length; _g < _i; _g++) { - pair = _h[_g]; - _f.push(pair[0]); + _result = []; _cache5 = BALANCED_PAIRS; + for (_index2 = 0, _cache6 = _cache5.length; _index2 < _cache6; _index2++) { + pair = _cache5[_index2]; + _result.push(pair[0]); } - return _f; + return _result; })(); EXPRESSION_END = (function() { - _j = []; _l = BALANCED_PAIRS; - for (_k = 0, _m = _l.length; _k < _m; _k++) { - pair = _l[_k]; - _j.push(pair[1]); + _result2 = []; _cache7 = BALANCED_PAIRS; + for (_index3 = 0, _cache8 = _cache7.length; _index3 < _cache8; _index3++) { + pair = _cache7[_index3]; + _result2.push(pair[1]); } - return _j; + return _result2; })(); EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END); IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; diff --git a/lib/scope.js b/lib/scope.js index b89e929b..4b2e9619 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -6,20 +6,20 @@ } exports.Scope = (function() { Scope = function(parent, expressions, method) { - var _a, _b, k, val; - _a = [parent, expressions, method]; - this.parent = _a[0]; - this.expressions = _a[1]; - this.method = _a[2]; + var _cache, _cache2, k, val; + _cache = [parent, expressions, method]; + this.parent = _cache[0]; + this.expressions = _cache[1]; + this.method = _cache[2]; this.variables = {}; this.tempVars = { general: '_a' }; if (this.parent) { - _b = this.parent.tempVars; - for (k in _b) { - if (!__hasProp.call(_b, k)) continue; - val = _b[k]; + _cache2 = this.parent.tempVars; + for (k in _cache2) { + if (!__hasProp.call(_cache2, k)) continue; + val = _cache2[k]; (this.tempVars[k] = val); } } else { @@ -36,11 +36,11 @@ return false; }; Scope.prototype.any = function(fn) { - var _a, k, v; - _a = this.variables; - for (v in _a) { - if (!__hasProp.call(_a, v)) continue; - k = _a[v]; + var _cache, k, v; + _cache = this.variables; + for (v in _cache) { + if (!__hasProp.call(_cache, v)) continue; + k = _cache[v]; if (fn(v, k)) { return true; } @@ -95,30 +95,30 @@ }); }; Scope.prototype.declaredVariables = function() { - var _a, _b, key, val; + var _cache, _result, key, val; return (function() { - _a = []; _b = this.variables; - for (key in _b) { - if (!__hasProp.call(_b, key)) continue; - val = _b[key]; + _result = []; _cache = this.variables; + for (key in _cache) { + if (!__hasProp.call(_cache, key)) continue; + val = _cache[key]; if (val === 'var') { - _a.push(key); + _result.push(key); } } - return _a; + return _result; }).call(this).sort(); }; Scope.prototype.assignedVariables = function() { - var _a, _b, key, val; - _a = []; _b = this.variables; - for (key in _b) { - if (!__hasProp.call(_b, key)) continue; - val = _b[key]; + var _cache, _result, key, val; + _result = []; _cache = this.variables; + for (key in _cache) { + if (!__hasProp.call(_cache, key)) continue; + val = _cache[key]; if (val.assigned) { - _a.push("" + (key) + " = " + (val.value)); + _result.push("" + (key) + " = " + (val.value)); } } - return _a; + return _result; }; Scope.prototype.compiledDeclarations = function() { return this.declaredVariables().join(', ');