clang-format: [JS] support null operators.
authorMartin Probst <martin@probst.io>
Thu, 7 Nov 2019 22:39:03 +0000 (23:39 +0100)
committerMartin Probst <martin@probst.io>
Mon, 11 Nov 2019 15:35:35 +0000 (16:35 +0100)
commita7638d384983e8e3eb44a2d8c757238efc7096dc
tree53214762176bda8ffaded6b59b65b643aaa1dbc3
parent48b7068beca9d3a39dcfbebcb384b59b7898065f
clang-format: [JS] support null operators.

Summary:
JavaScript / TypeScript is adding two new operators: the null
propagating operator `?.` and the nullish coalescing operator `??`.

    const x = foo ?? 'default';
    const z = foo?.bar?.baz;

This change adds support to lex and format both.

Reviewers: krasimir

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69971
clang/lib/Format/FormatToken.h
clang/lib/Format/FormatTokenLexer.cpp
clang/unittests/Format/FormatTestJS.cpp