Commit 45efd5b5 authored by Christian Kamm's avatar Christian Kamm

Don't show 'invalid property name' errors if we can't resolve the type.

The idea is that it may be a plugin-provided type. We don't want user
code to be riddled with error markers in that case.

Reviewed-by: Roberto Raggi
parent bb20672a
......@@ -71,7 +71,7 @@ bool Check::visit(UiProgram *ast)
bool Check::visit(UiObjectDefinition *ast)
{
visitQmlObject(ast, ast->initializer);
visitQmlObject(ast, ast->qualifiedTypeNameId, ast->initializer);
return false;
}
......@@ -79,12 +79,18 @@ bool Check::visit(UiObjectBinding *ast)
{
checkScopeObjectMember(ast->qualifiedId);
visitQmlObject(ast, ast->initializer);
visitQmlObject(ast, ast->qualifiedTypeNameId, ast->initializer);
return false;
}
void Check::visitQmlObject(AST::Node *ast, AST::UiObjectInitializer *initializer)
void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
UiObjectInitializer *initializer)
{
if (! _context.lookupType(_doc.data(), typeId)) {
warning(typeId->identifierToken, QLatin1String("unknown type"));
return;
}
const ObjectValue *oldScopeObject = _context.qmlScopeObject();
const ObjectValue *oldExtraScope = _extraScope;
const bool oldAllowAnyProperty = _allowAnyProperty;
......
......@@ -53,7 +53,8 @@ protected:
virtual bool visit(AST::UiArrayBinding *ast);
private:
void visitQmlObject(AST::Node *ast, AST::UiObjectInitializer *initializer);
void visitQmlObject(AST::Node *ast, AST::UiQualifiedId *typeId,
AST::UiObjectInitializer *initializer);
void checkScopeObjectMember(const AST::UiQualifiedId *id);
void warning(const AST::SourceLocation &loc, const QString &message);
......
......@@ -1114,9 +1114,6 @@ static void appendExtraSelectionsForMessages(
const QTextDocument *document)
{
foreach (const DiagnosticMessage &d, messages) {
if (d.isWarning())
continue;
const int line = d.loc.startLine;
const int column = qMax(1U, d.loc.startColumn);
......@@ -1130,7 +1127,11 @@ static void appendExtraSelectionsForMessages(
else
sel.cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
sel.format.setUnderlineColor(Qt::red);
if (d.isWarning())
sel.format.setUnderlineColor(Qt::darkYellow);
else
sel.format.setUnderlineColor(Qt::red);
sel.format.setUnderlineStyle(QTextCharFormat::WaveUnderline);
sel.format.setToolTip(d.message);
......
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