Try to get the type from a qualified-id.

This commit is contained in:
Roberto Raggi
2010-02-02 15:01:42 +01:00
parent 2443a4b365
commit fac977a5bd
5 changed files with 47 additions and 11 deletions

View File

@@ -142,11 +142,13 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
return;
const SemanticInfo semanticInfo = edit->semanticInfo();
const Snapshot snapshot = semanticInfo.snapshot;
Document::Ptr qmlDocument = semanticInfo.document;
if (qmlDocument.isNull())
if (semanticInfo.revision() != edit->documentRevision())
return;
const Snapshot snapshot = semanticInfo.snapshot;
const Document::Ptr qmlDocument = semanticInfo.document;
if (m_helpEngineNeedsSetup && m_helpEngine->registeredDocumentations().count() > 0) {
m_helpEngine->setupData();
m_helpEngineNeedsSetup = false;
@@ -169,10 +171,10 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
AST::UiObjectMember *declaringMember = semanticInfo.declaringMember(pos);
Interpreter::Engine interp;
Interpreter::ObjectValue *scope = Bind::scopeChainAt(qmlDocument, snapshot, &interp, declaringMember);
const Interpreter::ObjectValue *scope = Bind::scopeChainAt(qmlDocument, snapshot, &interp, declaringMember);
Check check(&interp);
const Interpreter::Value *value = check(node->expressionCast(), scope);
const Interpreter::Value *value = check(node, scope);
QStringList baseClasses;
m_toolTip = prettyPrint(value, &interp, &baseClasses);

View File

@@ -567,6 +567,16 @@ QmlJSTextEditor::~QmlJSTextEditor()
{
}
SemanticInfo QmlJSTextEditor::semanticInfo() const
{
return m_semanticInfo;
}
int QmlJSTextEditor::documentRevision() const
{
return document()->revision();
}
Core::IEditor *QmlJSEditorEditable::duplicate(QWidget *parent)
{
QmlJSTextEditor *newEditor = new QmlJSTextEditor(parent);

View File

@@ -131,7 +131,8 @@ public:
virtual void unCommentSelection();
SemanticInfo semanticInfo() const { return m_semanticInfo; }
SemanticInfo semanticInfo() const;
int documentRevision() const;
public slots:
virtual void setFontSettings(const TextEditor::FontSettings &);