QmlJS: Fix highlighting and completion for property declarations.

When property declarations use a custom type such as

property Foo bar

we now
* highlight Foo as a QML type if it's found
* complete bar. as a Foo

Change-Id: I82c249646af19bfeb9f5a7a7692f0dc10b009835
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-12-06 14:47:36 +01:00
parent 387d7a20ed
commit e1d1c9e6d6
2 changed files with 17 additions and 1 deletions

View File

@@ -1965,7 +1965,19 @@ const Value *ASTPropertyReference::value(ReferenceContext *referenceContext) con
return evaluator(_ast->statement);
}
return valueOwner()->defaultValueForBuiltinType(_ast->memberType.toString());
const QString memberType = _ast->memberType.toString();
const Value *builtin = valueOwner()->defaultValueForBuiltinType(memberType);
if (!builtin->asUndefinedValue())
return builtin;
if (_ast->typeModifier.isEmpty()) {
const Value *type = referenceContext->context()->lookupType(_doc, QStringList(memberType));
if (type)
return type;
}
return referenceContext->context()->valueOwner()->undefinedValue();
}
ASTSignal::ASTSignal(UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner)