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: unassignedclangb...@nondot.org
          Reporter: rib...@gmail.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to