| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turns "foo" into 'foo' (or vice versa, depending on configuration).
This makes it more convenient to follow the Google JavaScript style
guide:
https://google.github.io/styleguide/javascriptguide.xml?showone=Strings#Strings
This functionality is behind the option "JavaScriptQuotes", which can be:
* "leave" (no re-quoting)
* "single" (change to single quotes)
* "double" (change to double quotes)
This also changes single quoted JavaScript string literals to be treated
as tok::string_literal, not tok::char_literal, which fixes two unrelated
tests.
Patch by Martin Probst. Thank you.
llvm-svn: 262534
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var x = {
a: a,
b: b, 'c': c,
};
After:
var x = {
a: a,
b: b,
'c': c,
};
llvm-svn: 262291
|
|
|
|
|
|
| |
Patch by Martin Probst. Thank you.
llvm-svn: 261528
|
|
|
|
|
|
|
|
|
|
| |
Before:
for (var i of[2, 3]) {}
After:
for (var i of [2, 3]) {}
llvm-svn: 260518
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
f({a},
() => {
g(); //
});
After:
f({a}, () => {
g(); //
});
llvm-svn: 260060
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
enum?: string
[];
After:
enum?: string[];
llvm-svn: 259628
|
|
|
|
| |
llvm-svn: 259350
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
clang-format only works for JavaScript code, if all the semicolons are
present anyway, so this linebreak can never be desired.
Before (with appropriate statement lengths or column limit):
return
[ aaa ];
After:
return [
aaaa
];
llvm-svn: 257741
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After reading the style guides again, they don't actually say how to
pack or not pack array literals. Based on some user reports, array
initializers can unnecessarily get quite long if they contain many
small elements. Array literals with trailing commas are still formatted
one per line so that users have a way to opt out of the packing.
Before:
var array = [
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa,
aaaaaa
];
After:
var array = [
aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa,
aaaaaa, aaaaaa
];
llvm-svn: 257615
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
export abstract class X {y: number;}
(and all sorts of other havoc in more complicated cases).
After:
export abstract class X { y: number; }
llvm-svn: 257451
|
|
|
|
| |
llvm-svn: 257406
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
return [
aaaaaaaaaaaaaaaaaaaaaa
].aaaaaaa(function() {
//
})
.bbbbbb();
After:
return [aaaaaaaaaaaaaaaaaaaaaa]
.aaaaaaa(function() {
//
})
.bbbbbb();
llvm-svn: 257324
|
|
|
|
|
|
|
|
| |
Previously, all whitespace characters would increase the starting
column, which doesn't make sense. This fixes a problem, e.g. with the
length calculation in JS template strings.
llvm-svn: 257267
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var x: {
a: string;
b: number;
}
= {};
After:
var x: {a: string; b: number;} = {};
llvm-svn: 257255
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
over wrapping before parameters.
Before:
function someFunc(
args: string[]): {longReturnValue: string[]} {}
After:
function someFunc(args: string[]):
{longReturnValue: string[]} {}
llvm-svn: 257162
|
|
|
|
|
|
| |
Google configuration so that they aren't line-wrapped.
llvm-svn: 257159
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
foo = class {
constructor() {}
}
;
After:
foo = class {
constructor() {}
};
llvm-svn: 257154
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before (example is JS, but also applies to C++):
return [
aaaa()
.bbbbbbbb('A'),
aaaa().bbbbbbbb('B'),
aaaa().bbbbbbbb('C'),
];
After:
return [
aaaa().bbbbbbbb('A'),
aaaa().bbbbbbbb('B'),
aaaa().bbbbbbbb('C'),
];
llvm-svn: 257079
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
import a, {X, Y}
from 'some/module.js';
After:
import a, {X, Y} from 'some/module.js';
llvm-svn: 257038
|
|
|
|
| |
llvm-svn: 256759
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
export default[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb];
export default[];
After:
export default [
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
];
export default [];
llvm-svn: 256758
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, the [] in the following example were recognized as an array
subscript leading to weird indentation.
Before:
var aaaa = aaaaa || // wrap
[];
After:
var aaaa = aaaaa || // wrap
[];
llvm-svn: 256753
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
function foo(check: Object): check
is{foo: string, bar: string, baz: string, foobar: string} {
return 'bar' in check;
}
After:
function foo(check: Object):
check is {foo: string, bar: string, baz: string, foobar: string} {
return 'bar' in check;
}
llvm-svn: 256631
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
enum: string
[];
After:
enum: string[];
llvm-svn: 256546
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
interface I {
o: {}
[];
}
After:
interface I {
o: {}[];
}
llvm-svn: 256247
|
|
|
|
|
|
|
|
| |
initializers. For now, only use it for 20 items or more. Otherwise,
clang-format formats these one-per-line and thus increases the vertical
code size a lot.
llvm-svn: 256246
|
|
|
|
| |
llvm-svn: 256245
|
|
|
|
|
|
| |
The style guide allows both, but apparently, this is the more dominant use.
llvm-svn: 256154
|
|
|
|
|
|
| |
work properly.
llvm-svn: 253674
|
|
|
|
| |
llvm-svn: 253672
|
|
|
|
| |
llvm-svn: 253671
|
|
|
|
|
|
| |
is import-statement-like and shouldn't be wrapped.
llvm-svn: 251643
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
If this option is set, clang-format will always insert a line wrap, e.g.
before the first parameter of a function call unless all parameters fit
on the same line. This obviates the need to make a decision on the
alignment itself.
Use this style for Google's JavaScript style and add some minor tweaks
to correctly handle nested blocks etc. with it. Don't use this option
for for/while loops.
Reviewers: klimek
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D14104
llvm-svn: 251405
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a RegExp contains a character group with a quote (/["]/), the
trailing end of it is first tokenized as a string literal, which leads
to the merging code seeing an unbalanced bracket.
This change parses regex literals from the left hand side. That
simplifies the parsing code and also allows correctly handling escapes
and character classes, hopefully correctly parsing all regex literals.
Patch by Martin Probst, thank you.
Review: http://reviews.llvm.org/D13765
llvm-svn: 250648
|
|
|
|
|
|
|
|
|
| |
Slashes in regular expressions do not need to be escaped and do not
terminate the regular expression even without a preceding backslash.
Patch by Martin Probst. Thank you.
llvm-svn: 250009
|
|
|
|
|
|
|
|
|
| |
JavaScript allows keywords to appear in IdenfierName positions, e.g.
fields, or object literal members, but not as plain identifiers.
Patch by Martin Probst. Thank you!
llvm-svn: 248714
|
|
|
|
|
|
| |
Patch by Martin Probst. Thank you!
llvm-svn: 248713
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
class Test {
aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa:
aaaaaaaaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {}
}
After:
class Test {
aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaa):
aaaaaaaaaaaaaaaaaaaaaa {}
}
llvm-svn: 241908
|
|
|
|
| |
llvm-svn: 241446
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa:
aaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {}
After:
aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaa):
aaaaaaaaaaaaaaaaaaaaaa {}
llvm-svn: 241444
|
|
|
|
| |
llvm-svn: 241339
|
|
|
|
|
|
|
| |
Using the token type "unknown" can interfere badly with
WhitespaceManager's way of handling multiline comments.
llvm-svn: 241273
|
|
|
|
| |
llvm-svn: 241264
|
|
|
|
|
|
| |
The lexer wasn't properly reset leading to unexpected deletions.
llvm-svn: 241262
|
|
|
|
| |
llvm-svn: 241259
|
|
|
|
|
|
|
| |
Some counts were off, we don't need to take the leading newlines of the
first ` into account and some tests were just wrong.
llvm-svn: 241257
|
|
|
|
| |
llvm-svn: 240548
|
|
|
|
| |
llvm-svn: 240353
|
|
|
|
|
|
|
|
|
|
|
|
| |
The patch is generated using this command:
$ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
-checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
work/llvm/tools/clang
To reduce churn, not touching namespaces spanning less than 10 lines.
llvm-svn: 240270
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
var func =
function() {
doSomething();
};
After:
var func =
function() {
doSomething();
};
This is a very narrow special case which fixes most of the discrepency
with what our users do. In the long run, we should try to come up with
a more generic fix for indenting these.
llvm-svn: 240014
|