Commit 9220150
committed
clang-format: [JS] handle pseudo-keywords.
Summary:
The previous change in https://reviews.llvm.org/D77311 attempted to
detect more C++ keywords. However it also precisely detected all
JavaScript keywords. That's generally correct, but many JavaScripy
keywords, e.g. `get`, are so-called pseudo-keywords. They can be used in
positions where a keyword would never be legal, e.g. in a dotted
expression:
x.type; // type is a pseudo-keyword, but can be used here.
x.get; // same for get etc.
This change introduces an additional parameter to
`IsJavaScriptIdentifier`, allowing clients to toggle whether they want
to allow `IdentifierName` tokens, i.e. pseudo-keywords.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D775481 parent ab1fad8 commit 9220150
File tree
3 files changed
+24
-8
lines changed- clang
- lib/Format
- unittests/Format
3 files changed
+24
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
909 | 909 | | |
910 | 910 | | |
911 | 911 | | |
912 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
913 | 917 | | |
914 | 918 | | |
915 | 919 | | |
| |||
946 | 950 | | |
947 | 951 | | |
948 | 952 | | |
949 | | - | |
| 953 | + | |
950 | 954 | | |
951 | 955 | | |
952 | | - | |
953 | | - | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
954 | 961 | | |
955 | 962 | | |
956 | 963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1522 | 1522 | | |
1523 | 1523 | | |
1524 | 1524 | | |
1525 | | - | |
1526 | | - | |
1527 | | - | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
1528 | 1530 | | |
1529 | 1531 | | |
1530 | 1532 | | |
| |||
3071 | 3073 | | |
3072 | 3074 | | |
3073 | 3075 | | |
3074 | | - | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
3075 | 3079 | | |
3076 | 3080 | | |
3077 | 3081 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2412 | 2412 | | |
2413 | 2413 | | |
2414 | 2414 | | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
2415 | 2420 | | |
2416 | 2421 | | |
2417 | 2422 | | |
| |||
0 commit comments