Use the snapshot from the semanticinfo when processign QML/JS documents.

This commit is contained in:
Roberto Raggi
2010-02-02 10:41:48 +01:00
parent 18dd273547
commit 53d1eba3f7
2 changed files with 4 additions and 11 deletions

View File

@@ -140,8 +140,8 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
if (!edit)
return;
const Snapshot snapshot = m_modelManager->snapshot();
SemanticInfo semanticInfo = edit->semanticInfo();
const SemanticInfo semanticInfo = edit->semanticInfo();
const Snapshot snapshot = semanticInfo.snapshot;
Document::Ptr qmlDocument = semanticInfo.document;
if (qmlDocument.isNull())
return;
@@ -181,13 +181,7 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
QmlExpressionUnderCursor expressionUnderCursor;
QmlJS::AST::ExpressionNode *expression = expressionUnderCursor(tc);
AST::UiObjectMember *declaringMember = 0;
foreach (const Range &range, semanticInfo.ranges) {
if (pos >= range.begin.position() && pos <= range.end.position()) {
declaringMember = range.ast;
}
}
AST::UiObjectMember *declaringMember = semanticInfo.declaringMember(pos);
Interpreter::Engine interp;
Interpreter::ObjectValue *scope = Bind::scopeChainAt(qmlDocument, snapshot, &interp, declaringMember);