Commit e43e466b authored by Friedemann Kleint's avatar Friedemann Kleint

Reduce usage of QStringRef::toString() in QmlJS/QmlJSTools.

Change-Id: I9db2a0b21bf430d6f450e1e860a0c2a02272536f
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent 0c621dcd
......@@ -272,12 +272,12 @@ bool JsonCheck::visit(StringLiteral *ast)
analysis()->boostRanking();
const QString &literal = ast->value.toString();
const QStringRef literal = ast->value;
const QString &pattern = m_schema->pattern();
if (!pattern.isEmpty()) {
QRegExp regExp(pattern);
if (regExp.indexIn(literal) == -1) {
if (regExp.indexIn(literal.toString()) == -1) {
analysis()->m_messages.append(Message(ErrInvalidStringValuePattern,
ast->firstSourceLocation(),
QString(), QString(), false));
......
......@@ -201,10 +201,11 @@ bool Bind::visit(UiImport *ast)
_diagnosticMessages->append(
errorMessage(ast, tr("package import requires a version number")));
}
const QString importId = ast->importId.toString();
ImportInfo import = ImportInfo::moduleImport(toString(ast->importUri), version,
ast->importId.toString(), ast);
importId, ast);
if (_doc->language() == Document::QmlLanguage) {
QString importStr = import.name() + ast->importId.toString();
const QString importStr = import.name() + importId;
QmlLanguageBundles langBundles = ModelManagerInterface::instance()->extendedBundles();
QmlBundle qq1 = langBundles.bundleForLanguage(Document::QmlQtQuick1Language);
QmlBundle qq2 = langBundles.bundleForLanguage(Document::QmlQtQuick2Language);
......
......@@ -862,10 +862,11 @@ bool Check::visit(UiPublicMember *ast)
if (ast->type == UiPublicMember::Property) {
// check if the member type is valid
if (!ast->memberType.isEmpty()) {
const QString &name = ast->memberType.toString();
const QStringRef name = ast->memberType;
if (!name.isEmpty() && name.at(0).isLower()) {
if (!isValidBuiltinPropertyType(name))
addMessage(ErrInvalidPropertyType, ast->typeToken, name);
const QString nameS = name.toString();
if (!isValidBuiltinPropertyType(nameS))
addMessage(ErrInvalidPropertyType, ast->typeToken, nameS);
}
// warn about dubious use of var/variant
......
......@@ -229,7 +229,7 @@ QLinearGradient PropertyReader::parseGradient(const QString &propertyName, bool
initializer->lbraceToken,
initializer->rbraceToken));
const QString objectPropertyName = objectBinding->qualifiedId->name.toString();
const QString typeName = objectBinding->qualifiedTypeNameId->name.toString();
const QStringRef typeName = objectBinding->qualifiedTypeNameId->name;
if (objectPropertyName == propertyName && typeName.contains(QLatin1String("Gradient"))) {
QLinearGradient gradient;
QVector<QGradientStop> stops;
......
......@@ -154,7 +154,7 @@ QmlJS::AST::Node *SemanticInfo::declaringMemberNoProperties(int cursorPosition)
AST::Node *node = rangeAt(cursorPosition);
if (UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(node)) {
const QString &name = objectDefinition->qualifiedTypeNameId->name.toString();
const QStringRef name = objectDefinition->qualifiedTypeNameId->name;
if (!name.isEmpty() && name.at(0).isLower()) {
QList<AST::Node *> path = rangePath(cursorPosition);
if (path.size() > 1)
......@@ -165,7 +165,7 @@ QmlJS::AST::Node *SemanticInfo::declaringMemberNoProperties(int cursorPosition)
return path.at(path.size() - 3);
}
} else if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(node)) {
const QString &name = objectBinding->qualifiedTypeNameId->name.toString();
const QStringRef name = objectBinding->qualifiedTypeNameId->name;
if (name.contains(QLatin1String("Gradient"))) {
QList<AST::Node *> path = rangePath(cursorPosition);
if (path.size() > 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment