History log of /llvm-project/clang/unittests/Format/FormatTestJS.cpp (Results 251 – 275 of 353)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 90cf380e 17-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix typescript enum formatting.

Patch by Martin Probst.

Before:
enum {
A,
B
} var x = 1;

After:
enum {
A,
B
}
var x = 1;

llvm-svn: 239893


# b2ad4d4c 15-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Tweak behavior for multiline array initializer parameters

Before:
var someVariable = SomeFuntion(aaaa, [
aaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbb,
cc

clang-format: [JS] Tweak behavior for multiline array initializer parameters

Before:
var someVariable = SomeFuntion(aaaa, [
aaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbb,
ccccccccccccccccccccccccccc
],
aaaa);

After:
var someVariable = SomeFuntion(aaaa,
[
aaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbb,
ccccccccccccccccccccccccccc
],
aaaa);

llvm-svn: 239722

show more ...


# 2ebb0c57 14-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix corner case in template string parsing.

Before, these would not properly detected because of the char/string
literal found when re-lexing after the first `:

var x = `'`; /

clang-format: [JS] Fix corner case in template string parsing.

Before, these would not properly detected because of the char/string
literal found when re-lexing after the first `:

var x = `'`; // comment with matching quote '
var x = `"`; // comment with matching quote "

llvm-svn: 239693

show more ...


# 216c9cdb 12-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Support "export enum" declarations.

llvm-svn: 239595


# 4c0bf703 12-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Add tests to ensure clang-format doesn't break code
by triggering automatic semicolon insertion changes.

NFC intended. Patch by Martin Probst.

llvm-svn: 239594


# 259188b1 12-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix regression caused by r239592.

Without it, it would do:

interface I {
x: string;
} var y;

llvm-svn: 239593


# 910807d4 12-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] fix incorrectly collapsed lines after export
statement.

When an exported function would follow a class declaration, it would not
be recognized as a stand-alone function. That woul

clang-format: [JS] fix incorrectly collapsed lines after export
statement.

When an exported function would follow a class declaration, it would not
be recognized as a stand-alone function. That would then collapse the
following line with the current one, e.g.

class C {}
export function f() {} var x;

llvm-svn: 239592

show more ...


# 20580fd5 11-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: Make SFS_Inline imply SFS_Empty.

In the long run, these two might be independent or we might to only
allow specific combinations. Until we have a corresponding request,
however, it is

clang-format: Make SFS_Inline imply SFS_Empty.

In the long run, these two might be independent or we might to only
allow specific combinations. Until we have a corresponding request,
however, it is hard to do the right thing and choose the right
configuration options. Thus, just don't touch the options yet and
just modify the behavior slightly.

llvm-svn: 239531

show more ...


# 56691b8c 11-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Ensure that formatting actually takes place in tests.

And fix formatting issue discovered by that :-).

llvm-svn: 239530


# 11ca2639 10-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Only special case top level object literal
assignments as enums.

Top level object literals are treated as enums, and their k/v pairs are put on
separate lines:

X.Y = {
A: 1

clang-format: [JS] Only special case top level object literal
assignments as enums.

Top level object literals are treated as enums, and their k/v pairs are put on
separate lines:

X.Y = {
A: 1,
B: 2
};

However assignments within blocks should not be affected:

function x() {
y = {a:1, b:2};
}

This change fixes the second case. Patch by Martin Probst.

llvm-svn: 239462

show more ...


# 3b0f3045 05-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Let fat arrows have 'Assignment' precedence.

This is a more correct representation than using "Equality" introduced
in r238942 which was a quick fix to solve an actual regression.

clang-format: [JS] Let fat arrows have 'Assignment' precedence.

This is a more correct representation than using "Equality" introduced
in r238942 which was a quick fix to solve an actual regression.

According to the typescript spec, arrows behave like "low-precedence"
assignments.

Before:
var a = a.aaaaaaa((a: a) => aaaaaaaaaaaaaaaaaaaaa(bbbbbbbbb) &&
aaaaaaaaaaaaaaaaaaaaa(bbbbbbb));
After:
var a = a.aaaaaaa((a: a) => aaaaaaaaaaaaaaaaaaaaa(bbbbbbbbb) &&
aaaaaaaaaaaaaaaaaaaaa(bbbbbbb));

llvm-svn: 239137

show more ...


# 3c306e89 03-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Let fat arrows have 'Equality' precedence.

This fixes a regression in literal formatting:

Before:
aaaaaaaaaaaaa = {
aaaaaaaaaaaaaaaaaaaaaaaaaaaa: (aaaaaaaaaaaaaaaaaaaaaaaaa

clang-format: [JS] Let fat arrows have 'Equality' precedence.

This fixes a regression in literal formatting:

Before:
aaaaaaaaaaaaa = {
aaaaaaaaaaaaaaaaaaaaaaaaaaaa: (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) =>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
};

After:
var aaaaaaaaaaaaaaaaaaaa = {
aaaaaaaaaaaaaaaaaaaaaaaaaaaa:
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) =>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
};

Also apply no-else-after-return policy.

llvm-svn: 238942

show more ...


# 9970df1f 03-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] More aggressively keep array literals on one line.

Before:
var aaaaa: List<SomeThing> = [
new SomeThingAAAAAAAAAAAA(),
new SomeThingBBBBBBBBB()
];

After:
var aaaaa:

clang-format: [JS] More aggressively keep array literals on one line.

Before:
var aaaaa: List<SomeThing> = [
new SomeThingAAAAAAAAAAAA(),
new SomeThingBBBBBBBBB()
];

After:
var aaaaa: List<SomeThing> =
[new SomeThingAAAAAAAAAAAA(), new SomeThingBBBBBBBBB()];

llvm-svn: 238909

show more ...


# 81dbb564 03-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix bug in type colon detection.

Before, this couldn't be formatted at all:
class X {
subs = {
'b': {
'c': 1,
},
};
}

llvm-svn: 238907


# e497bedd 02-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Always add space after fat arrow.

Before:
return () =>[];

After:
return () => [];

llvm-svn: 238875


# d492b5ec 02-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Array literal detection fix #4.

llvm-svn: 238873


# 1feab0f9 02-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: Don't try to detect C++ lambdas in other languages.

llvm-svn: 238845


# 199d0c9e 02-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix incorrect line length calculation.

llvm-svn: 238841


# 40432cee 02-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Array literal detection fix #3.

llvm-svn: 238839


# 4284e362 02-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix another regression when detecting array literals.

llvm-svn: 238835


# 5ce80de4 02-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix regression of detecting array literals.

llvm-svn: 238832


# 1699eca1 01-Jun-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Making arrow function wrapping more consistent.

Before:
someFunction(() =>
{
doSomething(); // break
})
.doSomethingElse(

clang-format: [JS] Making arrow function wrapping more consistent.

Before:
someFunction(() =>
{
doSomething(); // break
})
.doSomethingElse( // break
);

After:
someFunction(() => {
doSomething(); // break
})
.doSomethingElse( // break
);

This is still bad, but at least it is consistent with what we do for other
function literals. Added corresponding tests.

llvm-svn: 238736

show more ...


# cd8d4ff9 31-May-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix line breaks in computed property names.

Before:
let foo = {
[someLongKeyHere]: 1,
someOtherLongKeyHere: 2, [keyLongEnoughToWrap]: 3,
lastLongKey: 4
};

After:

clang-format: [JS] Fix line breaks in computed property names.

Before:
let foo = {
[someLongKeyHere]: 1,
someOtherLongKeyHere: 2, [keyLongEnoughToWrap]: 3,
lastLongKey: 4
};

After:
let foo = {
[someLongKeyHere]: 1,
someOtherLongKeyHere: 2,
[keyLongEnoughToWrap]: 3,
lastLongKey: 4
};

llvm-svn: 238671

show more ...


# 8c42d445 29-May-2015 Daniel Jasper <djasper@google.com>

clang-format: [JS] Support ES6 computed property names.

Before:
var x = {
[a]: 1,
b: 2
};

After:
var x = {
[a]: 1,
b: 2
};

llvm-svn: 238544


# f841d3a6 28-May-2015 Daniel Jasper <djasper@google.com>

clang-format: Lower binding strengths created by the [] created by ObjC
method expressions and array literals. They should not bind stronger
than regular parentheses or the braces of braced lists.

S

clang-format: Lower binding strengths created by the [] created by ObjC
method expressions and array literals. They should not bind stronger
than regular parentheses or the braces of braced lists.

Specific test case in JavaScript:
Before:
var aaaaa: List<
SomeThing> = [new SomeThingAAAAAAAAAAAA(), new SomeThingBBBBBBBBB()];

After:
var aaaaa: List<SomeThing> = [
new SomeThingAAAAAAAAAAAA(),
new SomeThingBBBBBBBBB()
];

llvm-svn: 238400

show more ...


1...<<1112131415