forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/qds/dev'
Conflicts: src/libs/utils/filepath.cpp src/plugins/qmldesigner/qmldesignerexternaldependencies.cpp src/plugins/qmlprojectmanager/cmakegen/generatecmakelists.cpp tests/unit/unittest/CMakeLists.txt Change-Id: I017a6075db41a5233487ac855ffe23de2b2bb0ee
This commit is contained in:
@@ -1838,16 +1838,32 @@ bool Check::visit(CallExpression *ast)
|
||||
static const QStringList translationFunctions = {"qsTr", "qsTrId", "qsTranslate",
|
||||
"qsTrNoOp", "qsTrIdNoOp", "qsTranslateNoOp"};
|
||||
|
||||
static const QStringList whiteListedFunctions = {"toString", "toFixed", "toExponential", "toPrecision", "isFinite", "isNaN", "valueOf",
|
||||
"toLowerCase", "toLocaleString", "toLocaleLowerCase", "toUpperCase", "toLocaleUpperCase",
|
||||
"substring" , "charAt", "charCodeAt", "concat", "endsWith", "includes", "indexOf", "lastIndexOf"};
|
||||
static const QStringList whiteListedFunctions = {
|
||||
"toString", "toFixed", "toExponential", "toPrecision", "isFinite",
|
||||
"isNaN", "valueOf", "toLowerCase", "toLocaleString", "toLocaleLowerCase",
|
||||
"toUpperCase", "toLocaleUpperCase", "substring", "charAt", "charCodeAt",
|
||||
"concat", "endsWith", "includes", "indexOf", "lastIndexOf",
|
||||
"arg"};
|
||||
|
||||
static const QStringList colorFunctions = {"lighter", "darker", "rgba", "tint", "hsla", "hsva"};
|
||||
|
||||
static const QStringList qtFunction = {"point", "rect", "size", "vector2d", "vector3d", "vector4d", "quaternion" "matrix4x4", "formatDate",
|
||||
"formatDateTime", "formatTime", "resolvedUrl"};
|
||||
static const QStringList qtFunction = {"point",
|
||||
"rect",
|
||||
"size",
|
||||
"vector2d",
|
||||
"vector3d",
|
||||
"vector4d",
|
||||
"quaternion",
|
||||
"matrix4x4",
|
||||
"formatDate",
|
||||
"formatDateTime",
|
||||
"formatTime",
|
||||
"resolvedUrl"};
|
||||
|
||||
const bool whiteListedFunction = translationFunctions.contains(name)
|
||||
|| whiteListedFunctions.contains(name)
|
||||
|| colorFunctions.contains(name) || qtFunction.contains(name);
|
||||
|
||||
const bool whiteListedFunction = translationFunctions.contains(name) || whiteListedFunctions.contains(name) || colorFunctions.contains(name) || qtFunction.contains(name);
|
||||
|
||||
// We allow the Math. functions
|
||||
const bool isMathFunction = namespaceName == "Math";
|
||||
|
||||
@@ -523,8 +523,8 @@ bool LinkPrivate::importLibrary(const Document::Ptr &doc,
|
||||
bool subImportFound = importLibrary(doc, subImport.libraryPath, &subImport, targetObject, importPath, true);
|
||||
|
||||
if (!subImportFound && errorLoc.isValid()) {
|
||||
import->valid = false;
|
||||
if (!(optional || (toImport.flags & QmlDirParser::Import::Optional))) {
|
||||
import->valid = false;
|
||||
error(doc,
|
||||
errorLoc,
|
||||
Tr::tr("Implicit import '%1' of QML module '%2' not found.\n\n"
|
||||
|
||||
@@ -157,6 +157,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
|
||||
if ((qmlMetaObject->className() == "ListElement"
|
||||
|| qmlMetaObject->className() == "Connections")
|
||||
&& (qmlMetaObject->moduleName() == "Qt" || qmlMetaObject->moduleName() == "QtQml"
|
||||
|| qmlMetaObject->moduleName() == "QtQml.Base"
|
||||
|| qmlMetaObject->moduleName() == "QtQuick")) {
|
||||
qmlScopeObjects.clear();
|
||||
break;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
using namespace QmlJS;
|
||||
|
||||
bool ScopeChain::s_setSkipmakeComponentChain = false;
|
||||
|
||||
/*!
|
||||
\class QmlJS::ScopeChain
|
||||
\brief The ScopeChain class describes the scopes used for global lookup in
|
||||
@@ -210,6 +212,11 @@ QList<const ObjectValue *> ScopeChain::all() const
|
||||
return m_all;
|
||||
}
|
||||
|
||||
void ScopeChain::setSkipmakeComponentChain(bool b)
|
||||
{
|
||||
s_setSkipmakeComponentChain = b;
|
||||
}
|
||||
|
||||
static void collectScopes(const QmlComponentChain *chain, QList<const ObjectValue *> *target)
|
||||
{
|
||||
for (const QmlComponentChain *parent : chain->instantiatingComponents())
|
||||
@@ -351,6 +358,9 @@ void ScopeChain::makeComponentChain(
|
||||
const Snapshot &snapshot,
|
||||
QHash<const Document *, QmlComponentChain *> *components)
|
||||
{
|
||||
if (s_setSkipmakeComponentChain)
|
||||
return;
|
||||
|
||||
Document::Ptr doc = target->document();
|
||||
if (!doc->qmlProgram())
|
||||
return;
|
||||
|
||||
@@ -77,6 +77,8 @@ public:
|
||||
|
||||
QList<const ObjectValue *> all() const;
|
||||
|
||||
static void setSkipmakeComponentChain(bool b);
|
||||
|
||||
private:
|
||||
void update() const;
|
||||
void initializeRootScope();
|
||||
@@ -97,6 +99,8 @@ private:
|
||||
|
||||
mutable bool m_modified;
|
||||
mutable QList<const ObjectValue *> m_all;
|
||||
|
||||
static bool s_setSkipmakeComponentChain;
|
||||
};
|
||||
|
||||
} // namespace QmlJS
|
||||
|
||||
Reference in New Issue
Block a user