diff options
author | Martin Probst <martin@probst.io> | 2017-08-01 15:54:43 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2017-08-01 15:54:43 +0000 |
commit | 4bf1d7ad81df8795c0323d258147b18affee3301 (patch) | |
tree | 9d9f29168943c1796e09932d67b0e2c1e98e83b2 /clang/lib/Format/SortJavaScriptImports.cpp | |
parent | 02d5870de33da24382d53def9914737a496e1948 (diff) | |
download | bcm5719-llvm-4bf1d7ad81df8795c0323d258147b18affee3301.tar.gz bcm5719-llvm-4bf1d7ad81df8795c0323d258147b18affee3301.zip |
clang-format: [JS] support default imports.
Summary: Formerly, `import {default as X} from y;` would not be recognized as an import.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D36132
llvm-svn: 309697
Diffstat (limited to 'clang/lib/Format/SortJavaScriptImports.cpp')
-rw-r--r-- | clang/lib/Format/SortJavaScriptImports.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/SortJavaScriptImports.cpp b/clang/lib/Format/SortJavaScriptImports.cpp index e73695ca847..e08f4c3eec3 100644 --- a/clang/lib/Format/SortJavaScriptImports.cpp +++ b/clang/lib/Format/SortJavaScriptImports.cpp @@ -413,7 +413,7 @@ private: nextToken(); if (Current->is(tok::r_brace)) break; - if (Current->isNot(tok::identifier)) + if (!Current->isOneOf(tok::identifier, tok::kw_default)) return false; JsImportedSymbol Symbol; @@ -425,7 +425,7 @@ private: if (Current->is(Keywords.kw_as)) { nextToken(); - if (Current->isNot(tok::identifier)) + if (!Current->isOneOf(tok::identifier, tok::kw_default)) return false; Symbol.Alias = Current->TokenText; nextToken(); |