diff --git a/lib/lexer.js b/lib/lexer.js index fcf74b07..aa9056a4 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -135,6 +135,7 @@ break; default: return 0; + break; } this.line += count(string, '\n'); return string.length; diff --git a/lib/nodes.js b/lib/nodes.js index 1ebe6a75..9d20ddc5 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -1596,6 +1596,7 @@ return '--'; default: return pvar < 0 ? ' -= ' + pvar.slice(1) : ' += ' + pvar; + break; } })(); } @@ -1677,7 +1678,7 @@ } } if (this.otherwise) { - code += idt1 + ("default:\n" + (this.otherwise.compile(o, LEVEL_TOP)) + "\n"); + code += idt1 + ("default:\n" + (this.otherwise.compile(o, LEVEL_TOP)) + "\n" + idt2 + "break;\n"); } return code + this.tab + '}'; }; diff --git a/src/nodes.coffee b/src/nodes.coffee index b265bc9e..45393232 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -1370,7 +1370,7 @@ exports.Switch = class Switch extends Base for expr in block.expressions by -1 when expr not instanceof Comment code += idt2 + 'break;\n' unless expr instanceof Return break - code += idt1 + "default:\n#{ @otherwise.compile o, LEVEL_TOP }\n" if @otherwise + code += idt1 + "default:\n#{ @otherwise.compile o, LEVEL_TOP }\n#{idt2}break;\n" if @otherwise code + @tab + '}' #### If