Browse Source

Improved Token::get_kind to make Structured binding declarations work properly

master
eidheim 6 years ago
parent
commit
b8ff60c0f3
  1. 6
      src/token.cc

6
src/token.cc

@ -26,10 +26,10 @@ clangmm::Token::Kind clangmm::Token::get_kind() const {
bool clangmm::Token::is_identifier() const { bool clangmm::Token::is_identifier() const {
auto token_kind = get_kind(); auto token_kind = get_kind();
auto cursor = get_cursor(); if(token_kind == clangmm::Token::Kind::Identifier)
if(token_kind == clangmm::Token::Kind::Identifier && cursor.is_valid_kind())
return true; return true;
else if(token_kind == clangmm::Token::Kind::Keyword && cursor.is_valid_kind()) { auto cursor = get_cursor();
if(token_kind == clangmm::Token::Kind::Keyword && cursor.is_valid_kind()) {
auto spelling = get_spelling(); auto spelling = get_spelling();
if(spelling == "operator" || (spelling == "bool" && get_cursor().get_spelling() == "operator bool")) if(spelling == "operator" || (spelling == "bool" && get_cursor().get_spelling() == "operator bool"))
return true; return true;

Loading…
Cancel
Save