qmljs: fix qmljscheck

* fix ASTVariableReference::value: correctly get reference value type
by using either initialiser of bindingTarget (broken since a codemodel
update in 2018)
* disable warning for casting in bool to null comparison (it does not
cast, is always false)
* fix property checks (where skipped without default of readonly)
* remove non relevant checks (ErrInvalidPropertyType for lowercase  now that custom
value types are supported, and for properties called data)
* updated import version

Change-Id: I38407acf327d0f773b38dda4c02fb4d95a420851
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Fawzi Mohamed
2021-01-13 02:02:49 +01:00
parent 4f96e397d2
commit cc00af8334
14 changed files with 77 additions and 88 deletions

View File

@@ -1940,16 +1940,18 @@ const PatternElement *ASTVariableReference::ast() const
const Value *ASTVariableReference::value(ReferenceContext *referenceContext) const
{
// may be assigned to later
if (!m_ast->expressionCast())
ExpressionNode *exp = ((m_ast->initializer) ? m_ast->initializer : m_ast->bindingTarget);
if (!exp)
return valueOwner()->unknownValue();
Document::Ptr doc = m_doc->ptr();
ScopeChain scopeChain(doc, referenceContext->context());
ScopeBuilder builder(&scopeChain);
builder.push(ScopeAstPath(doc)(m_ast->expressionCast()->firstSourceLocation().begin()));
builder.push(ScopeAstPath(doc)(exp->firstSourceLocation().begin()));
Evaluate evaluator(&scopeChain, referenceContext);
return evaluator(m_ast->expressionCast());
const Value *res = evaluator(exp);
return res;
}
bool ASTVariableReference::getSourceLocation(QString *fileName, int *line, int *column) const