From ece400cfb634983e4e09227d81ec059a1dba1a19 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 14 Sep 2011 09:28:49 +0200 Subject: [PATCH] QmlJS: Enable 'follow symbol' for local variables. Task-number: QTCREATORBUG-6094 Change-Id: Icf286bc412b48dbd1cb38c47ad7b91040b5aae0f Reviewed-on: http://codereview.qt-project.org/4864 Reviewed-by: Thomas Hartmann --- src/libs/qmljs/qmljsinterpreter.cpp | 8 ++++++++ src/libs/qmljs/qmljsinterpreter.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index f288c36ed2..637f6dd182 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -1759,6 +1759,14 @@ const Value *ASTVariableReference::value(ReferenceContext *referenceContext) con return evaluator(_ast->expression); } +bool ASTVariableReference::getSourceLocation(QString *fileName, int *line, int *column) const +{ + *fileName = _doc->fileName(); + *line = _ast->identifierToken.startLine; + *column = _ast->identifierToken.startColumn; + return true; +} + ASTFunctionValue::ASTFunctionValue(FunctionExpression *ast, const Document *doc, ValueOwner *valueOwner) : FunctionValue(valueOwner), _ast(ast), _doc(doc) { diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 2fad1f43a0..22c0fb855c 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -716,6 +716,7 @@ public: private: virtual const Value *value(ReferenceContext *referenceContext) const; + virtual bool getSourceLocation(QString *fileName, int *line, int *column) const; }; class QMLJS_EXPORT ASTFunctionValue: public FunctionValue -- 2.11.0