Insert the semicolon at the end of the trimmed line only when it is stricly necessary.

This commit is contained in:
Roberto Raggi
2010-01-26 12:56:05 +01:00
parent df11fc95f9
commit f995022af7

View File

@@ -265,6 +265,8 @@ QString QmlJSIndenter::trimmedCodeLine(const QString &t)
needSemicolon = true;
break;
case Token::String:
case Token::Number:
case Token::Colon:
case Token::LeftBracket:
case Token::RightBracket:
@@ -278,7 +280,6 @@ QString QmlJSIndenter::trimmedCodeLine(const QString &t)
break;
default:
needSemicolon = true;
break;
} // end of switch
@@ -779,8 +780,8 @@ int QmlJSIndenter::indentForContinuationLine()
j + 1 < yyLine->length() && yyLine->at(j + 1) != '=') {
if (braceDepth == 0 && delimDepth == 0 &&
j < yyLine->length() - 1 &&
!yyLine->endsWith(QLatin1String(",")) &&
(yyLine->contains('(') == yyLine->contains(')')))
!yyLine->endsWith(QLatin1Char(',')) &&
(yyLine->contains(QLatin1Char('(')) == yyLine->contains(QLatin1Char(')'))))
hook = j;
}
}