forked from qt-creator/qt-creator
QmlJS: Disable possibly confusing warnings on qmlRegisterType.
Reviewed-by: Roberto Raggi Reviewed-by: Erik Verbruggen
This commit is contained in:
@@ -659,8 +659,10 @@ protected:
|
|||||||
if (StringLiteralAST *nameAst = ast->expression_list->next->next->next->value->asStringLiteral())
|
if (StringLiteralAST *nameAst = ast->expression_list->next->next->next->value->asStringLiteral())
|
||||||
nameLit = translationUnit()->stringLiteral(nameAst->literal_token);
|
nameLit = translationUnit()->stringLiteral(nameAst->literal_token);
|
||||||
if (!nameLit) {
|
if (!nameLit) {
|
||||||
translationUnit()->warning(ast->expression_list->next->next->next->value->firstToken(),
|
// disable this warning for now, we don't want to encourage using string literals if they don't mean to
|
||||||
"The type will only be available in Qt Creator's QML editors when the type name is a string literal");
|
// in the future, we will also accept annotations for the qmlRegisterType arguments in comments
|
||||||
|
// translationUnit()->warning(ast->expression_list->next->next->next->value->firstToken(),
|
||||||
|
// "The type will only be available in Qt Creator's QML editors when the type name is a string literal");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -700,9 +702,10 @@ protected:
|
|||||||
exportedType.majorVersion = QString::fromUtf8(majorLit->chars(), majorLit->size()).toInt();
|
exportedType.majorVersion = QString::fromUtf8(majorLit->chars(), majorLit->size()).toInt();
|
||||||
exportedType.minorVersion = QString::fromUtf8(minorLit->chars(), minorLit->size()).toInt();
|
exportedType.minorVersion = QString::fromUtf8(minorLit->chars(), minorLit->size()).toInt();
|
||||||
} else {
|
} else {
|
||||||
translationUnit()->warning(ast->base_expression->firstToken(),
|
// disable this warning, see above for details
|
||||||
"The module will not be available in Qt Creator's QML editors because the uri and version numbers\n"
|
// translationUnit()->warning(ast->base_expression->firstToken(),
|
||||||
"cannot be determined by static analysis. The type will still be available globally.");
|
// "The module will not be available in Qt Creator's QML editors because the uri and version numbers\n"
|
||||||
|
// "cannot be determined by static analysis. The type will still be available globally.");
|
||||||
exportedType.packageName = QLatin1String("<default>");
|
exportedType.packageName = QLatin1String("<default>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user