aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmljs/qmljsinterpreter.cpp
diff options
context:
space:
mode:
authorFawzi Mohamed <[email protected]>2021-01-13 02:02:49 +0100
committerFawzi Mohamed <[email protected]>2021-02-03 14:03:44 +0000
commitcc00af8334043326799ac281803cadb479b5efc4 (patch)
tree0668631ae746ec7e0837b94b5a866dff4c72bc6d /src/libs/qmljs/qmljsinterpreter.cpp
parent4f96e397d2fe91713694653e57471fcb5fdf7c7d (diff)
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 <[email protected]>
Diffstat (limited to 'src/libs/qmljs/qmljsinterpreter.cpp')
-rw-r--r--src/libs/qmljs/qmljsinterpreter.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp
index 87ba3984860..48df835d264 100644
--- a/src/libs/qmljs/qmljsinterpreter.cpp
+++ b/src/libs/qmljs/qmljsinterpreter.cpp
@@ -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