diff --git a/lib/cake.js b/lib/cake.js index 0e51a442..f9345c01 100755 --- a/lib/cake.js +++ b/lib/cake.js @@ -32,7 +32,7 @@ print_tasks = function print_tasks() { var _a, _b, _c, _d, _e, _f, _g, i, name, spaces, task; _a = []; _b = tasks; - for (name in _b) if (__hasProp.call(_b, name)) { + for (name in _b) { if (__hasProp.call(_b, name)) { task = _b[name]; _a.push((function() { spaces = 20 - name.length; @@ -45,7 +45,7 @@ }).call(this).join('') : ''; return puts("cake " + name + spaces + ' # ' + task.description); }).call(this)); - } + }} return _a; }; // Running `cake` runs the tasks you pass asynchronously (node-style), or diff --git a/lib/grammar.js b/lib/grammar.js index 9e6efc2c..d34384d9 100644 --- a/lib/grammar.js +++ b/lib/grammar.js @@ -524,7 +524,7 @@ bnf = {}; tokens = []; _a = grammar; - for (name in _a) if (__hasProp.call(_a, name)) { + for (name in _a) { if (__hasProp.call(_a, name)) { non_terminal = _a[name]; bnf[name] = (function() { _b = []; _c = non_terminal; @@ -542,7 +542,7 @@ } return _b; }).call(this); - } + }} tokens = tokens.join(" "); exports.parser = new Parser({ tokens: tokens, diff --git a/lib/nodes.js b/lib/nodes.js index 623d6fb2..c6359087 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -13,16 +13,16 @@ var _a, _b, fresh, key, val; fresh = {}; _a = options; - for (key in _a) if (__hasProp.call(_a, key)) { + for (key in _a) { if (__hasProp.call(_a, key)) { val = _a[key]; ((fresh[key] = val)); - } + }} if (overrides) { _b = overrides; - for (key in _b) if (__hasProp.call(_b, key)) { + for (key in _b) { if (__hasProp.call(_b, key)) { val = _b[key]; ((fresh[key] = val)); - } + }} } return fresh; }; @@ -66,10 +66,10 @@ klass.prototype = new _a(); klass.prototype.constructor = klass; _b = props; - for (name in _b) if (__hasProp.call(_b, name)) { + for (name in _b) { if (__hasProp.call(_b, name)) { prop = _b[name]; ((klass.prototype[name] = prop)); - } + }} return klass; }; // Mark a node as a statement, or a statement only. @@ -1116,7 +1116,7 @@ return true; }, compile_node: function compile_node(o) { - var body, body_dent, for_part, index, index_found, index_var, ivar, name, name_found, range, return_result, rvar, scope, set_result, source, source_part, step_part, svar, top_level, var_part, vars; + var body, body_dent, close, for_part, index, index_found, index_var, ivar, name, name_found, range, return_result, rvar, scope, set_result, source, source_part, step_part, svar, top_level, var_part, vars; top_level = del(o, 'top') && !o.returns; range = this.source instanceof ValueNode && this.source.base instanceof RangeNode && !this.source.properties.length; source = range ? this.source.base : this.source; @@ -1172,7 +1172,7 @@ } if (this.object) { o.scope.assign('__hasProp', 'Object.prototype.hasOwnProperty', true); - for_part = ivar + ' in ' + svar + ') if (__hasProp.call(' + svar + ', ' + ivar + ')'; + for_part = ivar + ' in ' + svar + ') { if (__hasProp.call(' + svar + ', ' + ivar + ')'; } if (!(top_level)) { return_result = '\n' + this.idt() + return_result + ';'; @@ -1182,7 +1182,8 @@ top: true })); vars = range ? name : name + ', ' + ivar; - return set_result + source_part + 'for (' + for_part + ') {\n' + var_part + body + '\n' + this.idt() + '}\n' + this.idt() + return_result; + close = this.object ? '}}\n' : '}\n'; + return set_result + source_part + 'for (' + for_part + ') {\n' + var_part + body + '\n' + this.idt() + close + this.idt() + return_result; } })); statement(ForNode); diff --git a/lib/rewriter.js b/lib/rewriter.js index 63414570..eac497c2 100644 --- a/lib/rewriter.js +++ b/lib/rewriter.js @@ -306,12 +306,12 @@ })(this)); unclosed = (function() { _i = []; _j = levels; - for (key in _j) if (__hasProp.call(_j, key)) { + for (key in _j) { if (__hasProp.call(_j, key)) { value = _j[key]; if (value > 0) { _i.push(key); } - } + }} return _i; }).call(this); if (unclosed.length) { @@ -336,10 +336,10 @@ stack = []; debt = {}; _i = INVERSES; - for (key in _i) if (__hasProp.call(_i, key)) { + for (key in _i) { if (__hasProp.call(_i, key)) { val = _i[key]; ((debt[key] = 0)); - } + }} return this.scan_tokens((function(__this) { var __func = function(prev, token, post, i) { var inv, match, mtag, tag; diff --git a/lib/scope.js b/lib/scope.js index deb20616..694327d6 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -81,12 +81,12 @@ var _a, _b, key, val; return (function() { _a = []; _b = this.variables; - for (key in _b) if (__hasProp.call(_b, key)) { + for (key in _b) { if (__hasProp.call(_b, key)) { val = _b[key]; if (val === 'var') { _a.push(key); } - } + }} return _a; }).call(this).sort(); }; @@ -95,12 +95,12 @@ Scope.prototype.assigned_variables = function assigned_variables() { var _a, _b, key, val; _a = []; _b = this.variables; - for (key in _b) if (__hasProp.call(_b, key)) { + for (key in _b) { if (__hasProp.call(_b, key)) { val = _b[key]; if (val.assigned) { _a.push(key + ' = ' + val.value); } - } + }} return _a; }; // Compile the string representing all of the declared variables for this scope. diff --git a/src/nodes.coffee b/src/nodes.coffee index 9f5b1412..9a566161 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -934,11 +934,12 @@ ForNode: exports.ForNode: inherit Node, { body: Expressions.wrap([new IfNode(@filter, body)]) if @object o.scope.assign('__hasProp', 'Object.prototype.hasOwnProperty', true) - for_part: ivar + ' in ' + svar + ') if (__hasProp.call(' + svar + ', ' + ivar + ')' + for_part: ivar + ' in ' + svar + ') { if (__hasProp.call(' + svar + ', ' + ivar + ')' return_result: '\n' + @idt() + return_result + ';' unless top_level body: body.compile(merge(o, {indent: body_dent, top: true})) vars: if range then name else name + ', ' + ivar - set_result + source_part + 'for (' + for_part + ') {\n' + var_part + body + '\n' + @idt() + '}\n' + @idt() + return_result + close: if @object then '}}\n' else '}\n' + set_result + source_part + 'for (' + for_part + ') {\n' + var_part + body + '\n' + @idt() + close + @idt() + return_result }