1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Adding break to default switch clauses to pass lint.

This commit is contained in:
Jeremy Ashkenas 2010-10-24 21:26:24 -04:00
parent 6a9c4380f3
commit 12b217c8ec
3 changed files with 4 additions and 2 deletions

View file

@ -135,6 +135,7 @@
break;
default:
return 0;
break;
}
this.line += count(string, '\n');
return string.length;

View file

@ -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 + '}';
};

View file

@ -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