Skip to content
Snippets Groups Projects
Commit e722570f authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Inserted a fake semicolon at the end of the trimmed line.

parent cb688f05
No related branches found
No related tags found
No related merge requests found
......@@ -250,6 +250,7 @@ QString QmlJSIndenter::trimmedCodeLine(const QString &t)
if (index != -1) {
const Token &last = yyLinizerState.tokens.at(index);
bool needSemicolon = false;
switch (last.kind) {
case Token::LeftParenthesis:
......@@ -261,25 +262,31 @@ QString QmlJSIndenter::trimmedCodeLine(const QString &t)
case Token::RightParenthesis:
case Token::RightBrace:
if (isBinding)
trimmed.append(QLatin1Char(';'));
needSemicolon = true;
break;
case Token::Colon:
case Token::LeftBracket:
case Token::RightBracket:
trimmed.append(QLatin1Char(';'));
needSemicolon = true;
break;
case Token::Identifier:
case Token::Keyword:
if (tokenText(last) != QLatin1String("else"))
trimmed.append(QLatin1Char(';'));
needSemicolon = true;
break;
default:
trimmed.append(QLatin1Char(';'));
needSemicolon = true;
break;
} // end of switch
if (needSemicolon) {
const Token sc(trimmed.size(), 1, Token::Semicolon);
yyLinizerState.tokens.append(sc);
trimmed.append(QLatin1Char(';'));
}
}
return trimmed;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment