diff --git a/lib/lexer.js b/lib/lexer.js index 14ab39af..191a587d 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -141,7 +141,7 @@ tag = 'LEADING_WHEN'; } this.i += id.length; - if (!accessed) { + if (!(accessed)) { if (include(COFFEE_ALIASES, id)) { tag = (id = CONVERSIONS[id]); } diff --git a/lib/nodes.js b/lib/nodes.js index c8a24a6c..69cfd5f4 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -845,7 +845,7 @@ props.push(prop); } } - if (!constructor) { + if (!(constructor)) { if (this.parent) { applied = new ValueNode(this.parent, [new AccessorNode(literal('apply'))]); constructor = new AssignNode(this.variable, new CodeNode([], new Expressions([new CallNode(applied, [literal('this'), literal('arguments')])]))); @@ -1202,7 +1202,7 @@ o.top = true; cond = this.condition.compile(o); set = ''; - if (!top) { + if (!(top)) { rvar = o.scope.free_variable(); set = ("" + this.tab + rvar + " = [];\n"); if (this.body) { @@ -1535,7 +1535,7 @@ } else if (name) { var_part = ("" + body_dent + name + " = " + svar + "[" + ivar + "];\n"); } - if (!this.object) { + if (!(this.object)) { lvar = scope.free_variable(); step_part = this.step ? ("" + ivar + " += " + (this.step.compile(o))) : ("" + ivar + "++"); for_part = ("" + ivar + " = 0, " + lvar + " = " + (svar) + ".length; " + ivar + " < " + lvar + "; " + step_part); diff --git a/src/lexer.coffee b/src/lexer.coffee index 6de5f202..538e238e 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -96,7 +96,7 @@ exports.Lexer: class Lexer @identifier_error id if include RESERVED, id tag: 'LEADING_WHEN' if tag is 'WHEN' and include LINE_BREAK, @tag() @i: + id.length - if not accessed + unless accessed tag: id: CONVERSIONS[id] if include COFFEE_ALIASES, id return @tag_half_assignment tag if @prev() and @prev()[0] is 'ASSIGN' and include HALF_ASSIGNMENTS, tag @token tag, id diff --git a/src/nodes.coffee b/src/nodes.coffee index 9340d958..45e39b8f 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -612,7 +612,7 @@ exports.ClassNode: class ClassNode extends BaseNode prop: new AssignNode(val, func) props.push prop - if not constructor + unless constructor if @parent applied: new ValueNode(@parent, [new AccessorNode(literal('apply'))]) constructor: new AssignNode(@variable, new CodeNode([], new Expressions([ @@ -878,7 +878,7 @@ exports.WhileNode: class WhileNode extends BaseNode o.top: true cond: @condition.compile(o) set: '' - if not top + unless top rvar: o.scope.free_variable() set: "$@tab$rvar = [];\n" @body: PushNode.wrap(rvar, @body) if @body @@ -1129,7 +1129,7 @@ exports.ForNode: class ForNode extends BaseNode var_part: new AssignNode(@name, literal("$svar[$ivar]")).compile(merge o, {indent: @idt(1), top: true}) + "\n" else var_part: "$body_dent$name = $svar[$ivar];\n" if name - if not @object + unless @object lvar: scope.free_variable() step_part: if @step then "$ivar += ${ @step.compile(o) }" else "$ivar++" for_part: "$ivar = 0, $lvar = ${svar}.length; $ivar < $lvar; $step_part" @@ -1188,7 +1188,7 @@ exports.IfNode: class IfNode extends BaseNode # Ensure that the switch expression isn't evaluated more than once. rewrite_switch: (o) -> assigner: @switcher - if not (@switcher.unwrap() instanceof LiteralNode) + unless @switcher.unwrap() instanceof LiteralNode variable: literal(o.scope.free_variable()) assigner: new AssignNode(variable, @switcher) @switcher: variable