Skip to content

Commit

Permalink
TokenList: apply enforced language early
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Jan 6, 2024
1 parent df584c4 commit c09158d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ TokenList::TokenList(const Settings* settings) :
mSettings(settings)
{
mTokensFrontBack.list = this;
if (mSettings && (mSettings->enforcedLang != Settings::Language::None)) {
mLang = mSettings->enforcedLang;
}
}

TokenList::~TokenList()
Expand Down Expand Up @@ -80,9 +83,8 @@ void TokenList::deallocateTokens()

void TokenList::determineCppC()
{
if (mSettings && (mSettings->enforcedLang != Settings::Language::None)) {
mLang = mSettings->enforcedLang;
} else {
// only try to determine it if it wasn't enforced
if (mLang == Settings::Language::None) {
if (Path::isC(getSourceFilePath()))
mLang = Settings::Language::C;
else if (Path::isCPP(getSourceFilePath()))
Expand Down

0 comments on commit c09158d

Please sign in to comment.