Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
8b339f92
Commit
8b339f92
authored
Dec 06, 2010
by
Christian Kamm
Browse files
JS checks: Check code block script bindings for common errors.
Reviewed-by: Erik Verbruggen
parent
23d77528
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljscheck.cpp
View file @
8b339f92
...
...
@@ -191,14 +191,8 @@ class FunctionBodyCheck : protected Visitor
public:
QList
<
DiagnosticMessage
>
operator
()(
FunctionExpression
*
function
,
Check
::
Options
options
)
{
clear
();
_options
=
options
;
_messages
.
clear
();
_declaredFunctions
.
clear
();
_declaredVariables
.
clear
();
_possiblyUndeclaredUses
.
clear
();
_seenNonDeclarationStatement
=
false
;
_formalParameterNames
.
clear
();
for
(
FormalParameterList
*
plist
=
function
->
formals
;
plist
;
plist
=
plist
->
next
)
{
if
(
plist
->
name
)
_formalParameterNames
+=
plist
->
name
->
asString
();
...
...
@@ -208,7 +202,25 @@ public:
return
_messages
;
}
QList
<
DiagnosticMessage
>
operator
()(
StatementList
*
statements
,
Check
::
Options
options
)
{
clear
();
_options
=
options
;
Node
::
accept
(
statements
,
this
);
return
_messages
;
}
protected:
void
clear
()
{
_messages
.
clear
();
_declaredFunctions
.
clear
();
_declaredVariables
.
clear
();
_possiblyUndeclaredUses
.
clear
();
_seenNonDeclarationStatement
=
false
;
_formalParameterNames
.
clear
();
}
void
postVisit
(
Node
*
ast
)
{
if
(
!
_seenNonDeclarationStatement
&&
ast
->
statementCast
()
...
...
@@ -470,6 +482,11 @@ bool Check::visit(UiScriptBinding *ast)
}
if
(
Block
*
block
=
cast
<
Block
*>
(
ast
->
statement
))
{
FunctionBodyCheck
bodyCheck
;
_messages
.
append
(
bodyCheck
(
block
->
statements
,
_options
));
}
return
true
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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