mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
fixing trailing herecomments with 'break'
This commit is contained in:
@@ -1915,7 +1915,7 @@
|
||||
return this;
|
||||
};
|
||||
Switch.prototype.compileNode = function(o) {
|
||||
var block, body, code, cond, conditions, exprs, i, idt1, idt2, _i, _len, _len2, _ref, _ref2, _ref3, _ref4;
|
||||
var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _len, _len2, _ref, _ref2, _ref3, _ref4;
|
||||
idt1 = o.indent + TAB;
|
||||
idt2 = o.indent = idt1 + TAB;
|
||||
code = this.tab + ("switch (" + (((_ref = this.subject) != null ? _ref.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n");
|
||||
@@ -1936,8 +1936,8 @@
|
||||
if (i === this.cases.length - 1 && !this.otherwise) {
|
||||
break;
|
||||
}
|
||||
exprs = block.expressions;
|
||||
if (!exprs.length || !last(exprs).isPureStatement()) {
|
||||
expr = last(block.expressions);
|
||||
if (!expr || !expr.isPureStatement() || expr instanceof Comment) {
|
||||
code += idt2 + 'break;\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1524,8 +1524,8 @@ exports.Switch = class Switch extends Base
|
||||
code += idt1 + "case #{ cond.compile o, LEVEL_PAREN }:\n"
|
||||
code += body + '\n' if body = block.compile o, LEVEL_TOP
|
||||
break if i is @cases.length - 1 and not @otherwise
|
||||
exprs = block.expressions
|
||||
if not exprs.length or not last(exprs).isPureStatement()
|
||||
expr = last block.expressions
|
||||
if not expr or not expr.isPureStatement() or expr instanceof Comment
|
||||
code += idt2 + 'break;\n'
|
||||
code += idt1 + "default:\n#{ @otherwise.compile o, LEVEL_TOP }\n" if @otherwise
|
||||
code + @tab + '}'
|
||||
|
||||
Reference in New Issue
Block a user