History log of /llvm-project/clang/unittests/Format/FormatTestJS.cpp (Results 126 – 150 of 353)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b98ab89e 13-Mar-2017 Martin Probst <martin@probst.io>

clang-format: [JS] do not wrap after interface and type.

Summary:
`interface` and `type` are pseudo keywords and cause automatic semicolon
insertion when followed by a line break:

interface //

clang-format: [JS] do not wrap after interface and type.

Summary:
`interface` and `type` are pseudo keywords and cause automatic semicolon
insertion when followed by a line break:

interface // gets parsed as a long variable access to "interface"
VeryLongInterfaceName {

}

With this change, clang-format not longer wraps after `interface` or `type`.

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D30874

llvm-svn: 297605

show more ...


# 17725d83 08-Mar-2017 Krasimir Georgiev <krasimir@google.com>

[clang-format] Enable comment reflowing in multiline comments containing pragmas

Summary:
This patch enables comment reflowing of lines not matching the comment pragma regex
in multiline comments co

[clang-format] Enable comment reflowing in multiline comments containing pragmas

Summary:
This patch enables comment reflowing of lines not matching the comment pragma regex
in multiline comments containing comment pragma lines. Previously, these comments
were dumped without being reindented to the result.

Reviewers: djasper, mprobst

Reviewed By: mprobst

Subscribers: klimek, mprobst, cfe-commits

Differential Revision: https://reviews.llvm.org/D30697

llvm-svn: 297261

show more ...


Revision tags: llvmorg-4.0.0, llvmorg-4.0.0-rc4, llvmorg-4.0.0-rc3
# 893b8adc 01-Mar-2017 Daniel Jasper <djasper@google.com>

clang-format: [JS] Properly format object literals with shorthands.

Before:
return {
a,
b: 'b', c,
};

After:
return {
a,
b: 'b',
c,
};

llvm-svn: 296664


# 01b8783a 01-Mar-2017 Daniel Jasper <djasper@google.com>

clang-format: [JS/TS] Properly understand cast expressions.

Many things were wrong:
- We didn't always allow wrapping after "as", which can be necessary.
- We used to Undestand the identifier after

clang-format: [JS/TS] Properly understand cast expressions.

Many things were wrong:
- We didn't always allow wrapping after "as", which can be necessary.
- We used to Undestand the identifier after "as" as a start of a name.
- We didn't properly parse the structure of the expression with "as"
having the precedence of relational operators

llvm-svn: 296659

show more ...


# bb46a7dd 28-Feb-2017 Martin Probst <martin@probst.io>

Blacklist arbitrary @\\w+ JSDoc tags from wrapping.

Summary:
Also limits the blacklisting to only apply when the tag is actually
followed by a parameter in curly braces.

/** @mods {long.type.mu

Blacklist arbitrary @\\w+ JSDoc tags from wrapping.

Summary:
Also limits the blacklisting to only apply when the tag is actually
followed by a parameter in curly braces.

/** @mods {long.type.must.not.wrap} */

vs

/** @const this is a long description that may wrap. */

Reviewers: djasper

Subscribers: klimek, krasimir, cfe-commits

Differential Revision: https://reviews.llvm.org/D30452

llvm-svn: 296467

show more ...


# 20371c30 27-Feb-2017 Martin Probst <martin@probst.io>

clang-format: [JS] whitespace after async in arrow functions.

Summary:
Async arrow functions should be marked with a whitespace after the async keyword, before the parameter list:
x = async () =

clang-format: [JS] whitespace after async in arrow functions.

Summary:
Async arrow functions should be marked with a whitespace after the async keyword, before the parameter list:
x = async () => foo();

Before:
x = async() => foo();

This makes it easier to tell apart an async arrow function from a call to a function called async.

Reviewers: bkramer

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D30399

llvm-svn: 296330

show more ...


# 98e0b12d 20-Feb-2017 Daniel Jasper <djasper@google.com>

clang-format: [JS] Improve line-wrapping behavior of template strings.

Specifically, similar to other blocks, clang-format now wraps both
after "${" and before the corresponding "}", if the containe

clang-format: [JS] Improve line-wrapping behavior of template strings.

Specifically, similar to other blocks, clang-format now wraps both
after "${" and before the corresponding "}", if the contained
expression spans multiple lines.

llvm-svn: 295663

show more ...


# 3d934d36 20-Feb-2017 Daniel Jasper <djasper@google.com>

clang-format: [JS/TS] Improve detection for array subscripts in types.

Before:
var someValue = (v as aaaaaaaaaaaaaaaaaaaa<T>[
]).someFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

Af

clang-format: [JS/TS] Improve detection for array subscripts in types.

Before:
var someValue = (v as aaaaaaaaaaaaaaaaaaaa<T>[
]).someFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
var someValue = (v as aaaaaaaaaaaaaaaaaaaa<T>[])
.someFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 295658

show more ...


Revision tags: llvmorg-4.0.0-rc2
# 8e3eba03 07-Feb-2017 Martin Probst <martin@probst.io>

clang-format: [JS] correcly format object literal methods.

Summary:
In JavaScript, object literals can contain methods:

var x = {
a() { return 1; },
};

Previously, clang-format always p

clang-format: [JS] correcly format object literal methods.

Summary:
In JavaScript, object literals can contain methods:

var x = {
a() { return 1; },
};

Previously, clang-format always parsed nested {} inside a braced list as
further braced lists. Special case this logic for JavaScript to try
parsing as a braced list, but fall back to parsing as a child block.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D29656

llvm-svn: 294315

show more ...


# 16282993 07-Feb-2017 Martin Probst <martin@probst.io>

clang-format: [JS] exclaim preceding regex literals.

Summary:
Regex detection would incorrectly classify a trailing `!` operator
(nullability cast) followed by a `/` as the start of a regular
expres

clang-format: [JS] exclaim preceding regex literals.

Summary:
Regex detection would incorrectly classify a trailing `!` operator
(nullability cast) followed by a `/` as the start of a regular
expression literal. This fixes code such as:

var foo = x()! / 10;

Which would previously parse a regexp all the way to the end of the
source file (or next `/`).

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29634

llvm-svn: 294304

show more ...


# 1027fb8a 07-Feb-2017 Martin Probst <martin@probst.io>

clang-format: [JS] handle parenthesized class expressions.

Summary:
In JavaScript, classes are expressions, so they can appear e.g. in
argument lists.

var C = foo(class {
bar() {

clang-format: [JS] handle parenthesized class expressions.

Summary:
In JavaScript, classes are expressions, so they can appear e.g. in
argument lists.

var C = foo(class {
bar() {
return 1;
}
};

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29635

llvm-svn: 294302

show more ...


# c06f6da3 03-Feb-2017 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix bugs in parsing and aligning template strings.

llvm-svn: 294009


# 3f11941d 31-Jan-2017 Daniel Jasper <djasper@google.com>

clang-format: [JS] Indent expressions in ${} relative to their surrounding

This only affects expressions inside ${} scopes of template strings.
Here, we want to indent relative to the surrounding te

clang-format: [JS] Indent expressions in ${} relative to their surrounding

This only affects expressions inside ${} scopes of template strings.
Here, we want to indent relative to the surrounding template string and
not the surrounding expression. Otherwise, this can create quite a mess.

Before:
var f = `
aaaaaaaaaaaaaaaaaa: ${someFunction(
aaaaa + //
bbbb)}`;

After:
var f = `
aaaaaaaaaaaaaaaaaa: ${someFunction(
aaaaa + //
bbbb)}`;

llvm-svn: 293636

show more ...


# 24de6fbf 31-Jan-2017 Daniel Jasper <djasper@google.com>

clang-format: [JS] Properly set scopes inside template strings.

Before:
var f = `aaaaaaaaaaaaa:${aaaaaaa
.aaaaa} aaaaaaaa
aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa`;

After:

clang-format: [JS] Properly set scopes inside template strings.

Before:
var f = `aaaaaaaaaaaaa:${aaaaaaa
.aaaaa} aaaaaaaa
aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa`;

After:
var f = `aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa
aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa`;

llvm-svn: 293622

show more ...


# f2019290 31-Jan-2017 Daniel Jasper <djasper@google.com>

clang-format: [JS] Fix incorrect line break in template strings.

Before:
var f = `aaaa ${a ? 'a' : 'b'
}`;

After:
var f = `aaaa ${a ? 'a' : 'b'}`;

llvm-svn: 293618


# 51c868e9 30-Jan-2017 Daniel Jasper <djasper@google.com>

clang-format: [JavaScript] Undo r291974 for JavaScript.

This had significant negative consequences and I don't have a good
solution for it yet.

Before:
var string =
[
'aaaaaa',

clang-format: [JavaScript] Undo r291974 for JavaScript.

This had significant negative consequences and I don't have a good
solution for it yet.

Before:
var string =
[
'aaaaaa',
'bbbbbb',
]
.join('+');

After:
var string = [
'aaaaaa',
'bbbbbb',
].join('+');

llvm-svn: 293465

show more ...


# fa37b18f 27-Jan-2017 Martin Probst <martin@probst.io>

clang-format: [JS] do not format MPEG transport streams.

Summary:
The MPEG transport stream file format also uses ".ts" as its file extension.
This change detects its specific framing format (0x47 e

clang-format: [JS] do not format MPEG transport streams.

Summary:
The MPEG transport stream file format also uses ".ts" as its file extension.
This change detects its specific framing format (0x47 every 189 bytes) and
simply ignores MPEG TS files.

Reviewers: djasper, sammccall

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D29186

llvm-svn: 293270

show more ...


Revision tags: llvmorg-4.0.0-rc1
# e6b5b34f 16-Jan-2017 Martin Probst <martin@probst.io>

clang-format: [JS] revert over-eager ASI check.

Summary: Change r291428 introduced ASI detection after closing curly braces. That would generally be correct, however this breaks indentation for stru

clang-format: [JS] revert over-eager ASI check.

Summary: Change r291428 introduced ASI detection after closing curly braces. That would generally be correct, however this breaks indentation for structural statements. What happens is that CompoundStatementIndenter increases indentation for the current line, then after reading ASI creates a new line (with the increased line level), and only after the structural parser sees e.g. the if/then/else branch closed, line level is reduced. That leads to the new line started by ASI having a level too high.

Reviewers: djasper

Subscribers: sammccall, cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D28763

llvm-svn: 292099

show more ...


# fd18ec58 09-Jan-2017 Martin Probst <martin@probst.io>

clang-format: [JS] fix broken test.

llvm-svn: 291429


# d40bca43 09-Jan-2017 Martin Probst <martin@probst.io>

clang-format: [JS] ASI after imports

Summary:
Automatic semicolon insertion should break import and export statements:

Before, this would format on one line:

// Note: no semi after 'x' below!

clang-format: [JS] ASI after imports

Summary:
Automatic semicolon insertion should break import and export statements:

Before, this would format on one line:

// Note: no semi after 'x' below!
import {x} from 'x'
export function foo() {}

Into:
import {x} from 'x' export function foo() {}

With this change, the statements get separated.

This also improves automatic semicolon insertion to consider closing
braces preceding declarations and statements.

Reviewers: klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28465

llvm-svn: 291428

show more ...


# e9987a1d 05-Jan-2017 Joerg Sonnenberger <joerg@bec.de>

Typo

llvm-svn: 291148


# af16c506 04-Jan-2017 Martin Probst <martin@probst.io>

clang-format: [JS] avoid indent after ambient function declarations.

Summary:
Before:
declare function foo();
let x = 1;

After:
declare function foo();
let x = 1;

The problem was that cl

clang-format: [JS] avoid indent after ambient function declarations.

Summary:
Before:
declare function foo();
let x = 1;

After:
declare function foo();
let x = 1;

The problem was that clang-format would unconditionally try to parse a child block, even though ambient function declarations do not have a body (similar to forward declarations).

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D28246

llvm-svn: 290959

show more ...


Revision tags: llvmorg-3.9.1, llvmorg-3.9.1-rc3, llvmorg-3.9.1-rc2, llvmorg-3.9.1-rc1
# e98e5811 29-Nov-2016 Daniel Jasper <djasper@google.com>

clang-format: [JS] Properly format dict literals that skip labels.

llvm-svn: 288121


# 72fd75a0 10-Nov-2016 Martin Probst <martin@probst.io>

clang-format: [JS] do not break after declare namespace.

See TypeScript grammar for tokens following 'declare':
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#A.10

llvm-svn: 286467


# 8315ea16 09-Nov-2016 Daniel Jasper <djasper@google.com>

clang-format: [TypeScript] Fix bug in handling of non-null operator.

Before:
var i = x!-1;

After:
var i = x! - 1;

llvm-svn: 286367


12345678910>>...15