Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
4ecf0349
Commit
4ecf0349
authored
Jul 16, 2010
by
Christian Kamm
Browse files
QmlJS: Make 'follow symbol' work on JS functions.
Task-number: QTCREATORBUG-1757
parent
68be307b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljsbind.cpp
View file @
4ecf0349
...
...
@@ -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
...
...
src/libs/qmljs/qmljsinterpreter.cpp
View file @
4ecf0349
...
...
@@ -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
)
{
setPrototype
(
engine
->
functionPrototype
());
...
...
@@ -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
),
...
...
src/libs/qmljs/qmljsinterpreter.h
View file @
4ecf0349
...
...
@@ -769,10 +769,11 @@ private:
class
QMLJS_EXPORT
ASTFunctionValue
:
public
FunctionValue
{
AST
::
FunctionDeclaration
*
_ast
;
const
Document
*
_doc
;
QList
<
NameId
*>
_argumentNames
;
public:
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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment