]> granicus.if.org Git - clang/commit
clang-format: [JS] exclaim preceding regex literals.
authorMartin Probst <martin@probst.io>
Tue, 7 Feb 2017 14:08:03 +0000 (14:08 +0000)
committerMartin Probst <martin@probst.io>
Tue, 7 Feb 2017 14:08:03 +0000 (14:08 +0000)
commitdf3167650dd04ae5c03a44caa3d4ce4beb0c3cbd
tree6d1c444e55e9bcee0d8738385119cdfd4039aa9c
parentae1b99494b1c2c8de6b6333a168bcb16022ed559
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294304 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/FormatTokenLexer.cpp
unittests/Format/FormatTestJS.cpp