fix class method formatting (#1853)

fixes #1852
This commit is contained in:
kzc
2017-04-29 06:13:25 -04:00
committed by Alex Lam S.L
parent 278577f3cb
commit 5c6316a37d
2 changed files with 22 additions and 1 deletions

View File

@@ -1597,7 +1597,6 @@ function OutputStream(options) {
if (self.is_generator) { if (self.is_generator) {
output.print("*"); output.print("*");
} }
output.space();
if (self.key instanceof AST_SymbolMethod) { if (self.key instanceof AST_SymbolMethod) {
self.print_property_name(self.key.name, self.quote, output); self.print_property_name(self.key.name, self.quote, output);
} else { } else {

View File

@@ -370,3 +370,25 @@ issue_1613: {
} }
expect_exact: "const n=1;const c={name:n};" expect_exact: "const n=1;const c={name:n};"
} }
format_methods: {
beautify = {
beautify: true,
}
input: {
class A extends B {constructor(a){x()} static s(b,c){y()} run(d,e,f){z()}}
}
expect_exact: [
"class A extends B {",
" constructor(a) {",
" x();",
" }",
" static s(b, c) {",
" y();",
" }",
" run(d, e, f) {",
" z();",
" }",
"}",
]
}