Files
qt-creator/tests/auto/qml/codemodel/check/unreachable.qml
Christian Kamm be9d25ec64 QmlJS checks: Warn when using some builtin constructors.
Number, String, Array, Object, Function and Boolean should not
be used.

Migrated from QtChecker.

Change-Id: I8aee41f12389196ed49c44e26eb04d3fac040a2b
Reviewed-on: http://codereview.qt-project.org/5859
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
2011-10-10 14:40:03 +02:00

105 lines
1.6 KiB
QML

import Qt 4.7
// DEFAULTMSG unreachable
Item {
function foo() {
return
x() // 28 9 11
x()
}
function foo() {
throw {}
x() // 28 9 11
x()
}
function foo() {
if (a)
return
x()
if (a)
foo();
else
return
x()
if (a)
return
else
return
x() // 28 9 11
}
function foo() {
try {
throw 1
} finally {}
x() // 28 9 11
}
function foo() {
try {
} finally {
return
}
x() // 28 9 11
}
function foo() {
try {
} catch(a) {
return
}
x()
try {
return
} catch(a) {
}
x()
try {
return
} catch(a) {
return
}
x() // 28 9 11
}
function foo() {
switch (a) {
case 0:
break
case 1:
case 2:
return
}
x()
switch (a) {
case 1:
case 2:
return
}
x()
switch (a) {
case 1:
case 2:
return
default:
return
}
x() // 28 9 11
}
function foo() {
l1: do {
l2: while (b) {
return
}
x()
l3: do {
break l1
} while (b);
x() // 28 13 15
} while (a);
x() // reachable via break
}
}