Zen icon indicating copy to clipboard operation
Zen copied to clipboard

Report unreachable statements because of return and throw statements

Open itssamuelrowe opened this issue 5 years ago • 0 comments

The compiler should analyze the function body to detect statements that are completely unreachable because of return and throw statements that cause a function to exit.

Consider the following example:

function main(...arguments)
    return 0
    print('Hello, world!')

In the above example, the print statement is never executed because main() is terminated before it can reach the print statement.

itssamuelrowe avatar May 13 '20 09:05 itssamuelrowe