mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
switch with debugger in a case should still break, afterwards.
This commit is contained in:
parent
8fd78d3819
commit
dbeb626f32
2 changed files with 7 additions and 5 deletions
|
@ -1957,7 +1957,7 @@
|
|||
return this;
|
||||
};
|
||||
Switch.prototype.compileNode = function(o) {
|
||||
var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _len, _len2, _ref, _ref2, _ref3, _ref4;
|
||||
var block, body, code, cond, conditions, expr, i, idt1, idt2, jumper, _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");
|
||||
|
@ -1979,11 +1979,12 @@
|
|||
break;
|
||||
}
|
||||
expr = this.lastNonComment(block.expressions);
|
||||
if (!expr || !expr.jumps()) {
|
||||
jumper = expr.jumps();
|
||||
if (!expr || !jumper || (jumper instanceof Literal && jumper.value === 'debugger')) {
|
||||
code += idt2 + 'break;\n';
|
||||
}
|
||||
}
|
||||
if (this.otherwise) {
|
||||
if (this.otherwise && this.otherwise.expressions.length) {
|
||||
code += idt1 + ("default:\n" + (this.otherwise.compile(o, LEVEL_TOP)) + "\n");
|
||||
}
|
||||
return code + this.tab + '}';
|
||||
|
|
|
@ -1554,9 +1554,10 @@ exports.Switch = class Switch extends Base
|
|||
code += body + '\n' if body = block.compile o, LEVEL_TOP
|
||||
break if i is @cases.length - 1 and not @otherwise
|
||||
expr = @lastNonComment block.expressions
|
||||
if not expr or not expr.jumps()
|
||||
jumper = expr.jumps()
|
||||
if not expr or not jumper or (jumper instanceof Literal and jumper.value is 'debugger')
|
||||
code += idt2 + 'break;\n'
|
||||
code += idt1 + "default:\n#{ @otherwise.compile o, LEVEL_TOP }\n" if @otherwise
|
||||
code += idt1 + "default:\n#{ @otherwise.compile o, LEVEL_TOP }\n" if @otherwise and @otherwise.expressions.length
|
||||
code + @tab + '}'
|
||||
|
||||
#### If
|
||||
|
|
Loading…
Reference in a new issue