Skip to content

Commit 55b6d4b

Browse files
committedJan 7, 2019
clang-format: [JS] support goog.requireType.
Summary: It's a new primitive for importing symbols, and should be treated like the (previously handled) `goog.require` and `goog.forwardDeclare`. Reviewers: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56385 llvm-svn: 350516
1 parent e1ced5c commit 55b6d4b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
 

‎clang/lib/Format/TokenAnnotator.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,7 @@ class AnnotatingParser {
11231123
(Tok.Next->Next->TokenText == "module" ||
11241124
Tok.Next->Next->TokenText == "provide" ||
11251125
Tok.Next->Next->TokenText == "require" ||
1126+
Tok.Next->Next->TokenText == "requireType" ||
11261127
Tok.Next->Next->TokenText == "forwardDeclare") &&
11271128
Tok.Next->Next->Next && Tok.Next->Next->Next->is(tok::l_paren);
11281129
}

‎clang/unittests/Format/FormatTestJS.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,8 @@ TEST_F(FormatTestJS, GoogModules) {
600600
getGoogleJSStyleWithColumns(40));
601601
verifyFormat("var long = goog.require('this.is.really.absurdly.long');",
602602
getGoogleJSStyleWithColumns(40));
603+
verifyFormat("const X = goog.requireType('this.is.really.absurdly.long');",
604+
getGoogleJSStyleWithColumns(40));
603605
verifyFormat("goog.forwardDeclare('this.is.really.absurdly.long');",
604606
getGoogleJSStyleWithColumns(40));
605607

0 commit comments

Comments
 (0)
Please sign in to comment.