summaryrefslogtreecommitdiffstats
path: root/lib/Format/UnwrappedLineParser.h
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2017-02-07 14:05:30 +0000
committerMartin Probst <martin@probst.io>2017-02-07 14:05:30 +0000
commitae1b99494b1c2c8de6b6333a168bcb16022ed559 (patch)
tree815525fca22e245a2b5d9a89a77c0cabb351f1cd /lib/Format/UnwrappedLineParser.h
parent9630f7cdaa789146b10dd6816f1569a853f50cd4 (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294302 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.h')
-rw-r--r--lib/Format/UnwrappedLineParser.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Format/UnwrappedLineParser.h b/lib/Format/UnwrappedLineParser.h
index b03009511d..c34e5b9ec7 100644
--- a/lib/Format/UnwrappedLineParser.h
+++ b/lib/Format/UnwrappedLineParser.h
@@ -100,7 +100,10 @@ private:
void parseAccessSpecifier();
bool parseEnum();
void parseJavaEnumBody();
- void parseRecord();
+ // Parses a record (aka class) as a top level element. If ParseAsExpr is true,
+ // parses the record as a child block, i.e. if the class declaration is an
+ // expression.
+ void parseRecord(bool ParseAsExpr = false);
void parseObjCProtocolList();
void parseObjCUntilAtEnd();
void parseObjCInterfaceOrImplementation();
@@ -162,7 +165,7 @@ private:
const FormatStyle &Style;
const AdditionalKeywords &Keywords;
-
+
llvm::Regex CommentPragmasRegex;
FormatTokenSource *Tokens;