[llvm-bugs] [Bug 33154] New: inconsistent formatting of javascript function braces

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 24 07:23:51 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33154

            Bug ID: 33154
           Summary: inconsistent formatting of javascript function braces
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ribrdb at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

The formatting of javascript functions is weird. Sometimes it indents the
closing brace, for the function and sometimes not. I can't seem to change this
behavior with any style settings.
Based on my testing it seems like it gets indented unless one of these is true:
 - the function is assigned to a variable
 - there's a semicolon after the closing brace
 - it's the last function in the file

$ clang-format -style=LLVM test.js
function foo() {
  1;
  2;
  }
let foo = function() {
  1;
  2;
}
function() {
  1;
  2;
  }
function foo() {
  1;
  2;
};
function foo() {
  1;
  2;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170524/a468bb6f/attachment-0001.html>


More information about the llvm-bugs mailing list