[PATCH] Support for JavaScript === and !== operators.
Alexander Kornienko
alexfh at google.com
Wed Nov 20 05:59:41 PST 2013
Hi klimek, djasper,
http://llvm-reviews.chandlerc.com/D2231
Files:
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp
Index: lib/Format/TokenAnnotator.cpp
===================================================================
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -1363,6 +1363,10 @@
if (Tok.isOneOf(tok::arrowstar, tok::periodstar) ||
Tok.Previous->isOneOf(tok::arrowstar, tok::periodstar))
return false;
+ // JavaScript identity operators ===, !==.
+ if (Tok.Previous->isOneOf(tok::equalequal, tok::exclaimequal) &&
+ Tok.is(tok::equal))
+ return false;
if (!Style.SpaceBeforeAssignmentOperators &&
Tok.getPrecedence() == prec::Assignment)
return false;
@@ -1452,6 +1456,9 @@
return false;
if (Left.is(tok::equal) && Line.Type == LT_VirtualFunctionDecl)
return false;
+ // JavaScript identity operators ===, !==.
+ if (Left.isOneOf(tok::equalequal, tok::exclaimequal) && Right.is(tok::equal))
+ return false;
if (Left.Previous) {
if (Left.is(tok::l_paren) && Right.is(tok::l_paren) &&
Left.Previous->is(tok::kw___attribute))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2231.1.patch
Type: text/x-patch
Size: 1014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131120/2394469e/attachment.bin>
More information about the cfe-commits
mailing list