https://bugs.llvm.org/show_bug.cgi?id=40999
Bug ID: 40999
Summary: clang-format messes up indentation when using
JavaScript private fields and methods
Product: clang
Version: 8.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangb...@nondot.org
Reporter: d...@domenic.me
CC: djas...@google.com, kli...@google.com,
llvm-bugs@lists.llvm.org
Input:
class Example {
pub = 1;
#priv = 2;
static pub2 = "foo"
static #priv2 = "bar";
method() {
this.#priv = 5;
}
static staticMethod() {
}
#privateMethod() {
this.#privateMethod(); // infinite loop
}
static #staticPrivateMethod() {
}
}
clang-format -i test.js
Output:
class Example {
pub = 1;
#priv = 2;
static pub2 = 'foo' static #priv2 = 'bar';
method() {
this.#priv = 5;
}
static staticMethod() {}
#privateMethod() {
this.#privateMethod(); // infinite loop
}
static #staticPrivateMethod() {}
}
Expected output: something like
class Example {
pub = 1;
#priv = 2;
static pub2 = 'foo';
static #priv2 = 'bar';
method() {
this.#priv = 5;
}
static staticMethod() {}
#privateMethod() {
this.#privateMethod(); // infinite loop
}
static #staticPrivateMethod() {}
}
Private fields are a relatively new JavaScript feature, but we are hoping to
use them in Google Chrome:
https://chromium-review.googlesource.com/c/chromium/src/+/1496278
clang-format version 8.0.0 (trunk 346566)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs