aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFawzi Mohamed <fawzi.mohamed@qt.io>2020-07-29 02:27:00 +0200
committerFawzi Mohamed <fawzi.mohamed@qt.io>2020-08-03 06:31:08 +0000
commit1ea9d6ce87f62c885e534aa26e34c0cd4fcf45d4 (patch)
treecf0960a1a5c9d4fb513dae75e32e4dd2213f81be
parentd59f22d00019d81b3192d64298a26244f54fbd84 (diff)
qmljs: fix unreachable test for catch clause
Change-Id: Ica1ff034b88f06849026957c8beed2cda77badcc Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/libs/qmljs/qmljscheck.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp
index f58b414487..175ea0341d 100644
--- a/src/libs/qmljs/qmljscheck.cpp
+++ b/src/libs/qmljs/qmljscheck.cpp
@@ -502,13 +502,13 @@ protected:
return false;
}
- bool visit(Block *) override
+ bool openBlock()
{
++_block;
return true;
}
- void endVisit(Block *) override
+ void closeBlock()
{
auto it = _declaredBlockVariables.begin();
auto end = _declaredBlockVariables.end();
@@ -521,6 +521,26 @@ protected:
--_block;
}
+ bool visit(Block *) override
+ {
+ return openBlock();
+ }
+
+ void endVisit(Block *) override
+ {
+ closeBlock();
+ }
+
+ bool visit(Catch *) override
+ {
+ return openBlock();
+ }
+
+ void endVisit(Catch *) override
+ {
+ closeBlock();
+ }
+
void throwRecursionDepthError() override
{
addMessage(ErrHitMaximumRecursion, SourceLocation());