Commit 4ecf0349 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Make 'follow symbol' work on JS functions.

Task-number: QTCREATORBUG-1757
parent 68be307b
......@@ -282,7 +282,7 @@ bool Bind::visit(FunctionDeclaration *ast)
//if (_currentObjectValue->property(ast->name->asString(), 0))
// return false;
ASTFunctionValue *function = new ASTFunctionValue(ast, &_engine);
ASTFunctionValue *function = new ASTFunctionValue(ast, _doc, &_engine);
_currentObjectValue->setProperty(ast->name->asString(), function);
// build function scope
......@@ -2959,8 +2959,8 @@ const Value *ASTVariableReference::value(Context *context) const
return check(_ast->expression);
ASTFunctionValue::ASTFunctionValue(FunctionDeclaration *ast, Engine *engine)
: FunctionValue(engine), _ast(ast)
ASTFunctionValue::ASTFunctionValue(FunctionDeclaration *ast, const Document *doc, Engine *engine)
: FunctionValue(engine), _doc(doc), _ast(ast)
......@@ -3007,6 +3007,14 @@ bool ASTFunctionValue::isVariadic() const
return true;
bool ASTFunctionValue::getSourceLocation(QString *fileName, int *line, int *column) const
*fileName = _doc->fileName();
*line = _ast->identifierToken.startLine;
*column = _ast->identifierToken.startColumn;
return true;
QmlPrototypeReference::QmlPrototypeReference(UiQualifiedId *qmlTypeName, const QmlJS::Document *doc,
Engine *engine)
: Reference(engine),
......@@ -769,10 +769,11 @@ private:
class QMLJS_EXPORT ASTFunctionValue: public FunctionValue
AST::FunctionDeclaration *_ast;
const Document *_doc;
QList<NameId *> _argumentNames;
ASTFunctionValue(AST::FunctionDeclaration *ast, Engine *engine);
ASTFunctionValue(AST::FunctionDeclaration *ast, const Document *doc, Engine *engine);
virtual ~ASTFunctionValue();
AST::FunctionDeclaration *ast() const;
......@@ -782,6 +783,8 @@ public:
virtual const Value *argument(int) const;
virtual QString argumentName(int index) const;
virtual bool isVariadic() const;
virtual bool getSourceLocation(QString *fileName, int *line, int *column) const;
class QMLJS_EXPORT ASTPropertyReference: public Reference
Supports Markdown
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