Merge pull request #267 from will-v-king/master

added a deindent() function .
This commit is contained in:
Liam Newman 2013-05-26 21:10:28 -07:00
commit 8fe8e64922
2 changed files with 8 additions and 2 deletions

View File

@ -436,6 +436,10 @@
function indent() {
flags.indentation_level += 1;
}
function deindent() {
flags.indentation_level -= 1;
}
function set_mode(mode) {
if (flags) {
@ -1160,7 +1164,7 @@
print_newline();
if (flags.case_body || opt.jslint_happy) {
// switch cases following one another
flags.indentation_level--;
deindent();
flags.case_body = false;
}
print_token();

View File

@ -450,6 +450,8 @@ class Beautifier:
def indent(self):
self.flags.indentation_level += 1
def deindent(self):
self.flags.indentation_level -= 1
def set_mode(self, mode):
if self.flags:
@ -990,7 +992,7 @@ class Beautifier:
self.append_newline()
if self.flags.case_body or self.opts.jslint_happy:
self.flags.case_body = False
self.flags.indentation_level -= 1
self.deindent()
self.append_token(token_text)
self.flags.in_case = True
self.flags.in_case_statement = True