I don’t understand how the Dart Editor evaluates expressions, assuming the code is dead

This source code generates a warning in the Dart Editor. Dead code

1)

if(false) {
}

But these are constant expressions, which are also evaluated as false, do not generate warnings.

2)

if("hello" is int) {
}

3)

if(false || false) {
}

4)

if(false == true) {
}

5)

if(0 > 0) {
}

How can an editor help me in these cases?

You might think that all my examples are not from real life.

But I can also assume that this code is not from real life.

if(false) {
}

So, how can support only case No. 1 and the lack of support for cases No. 2, No. 3, No. 4, No. 5 and all other possible cases help me find the dead code in the Dart Editor?

PS

Of course, this is a great opportunity for the Dart Editor, and I don’t want to downplay its usefulness, but I still want to know: "Is it possible to do even more from what was a little more useful?"

+4
1

, "", , .

SO -, , , true/false, . , , , , , , - ...

+3

Source: https://habr.com/ru/post/1525919/


All Articles