summaryrefslogtreecommitdiff
path: root/core/io/packet_peer.cpp
diff options
context:
space:
mode:
authorTan Wang Leng <tanwangleng@outlook.com>2020-02-04 15:58:27 +0800
committerTan Wang Leng <tanwangleng@outlook.com>2020-05-16 20:02:55 +0800
commit7b1423a61ea6a5249d29ddbb3866ce815f16497c (patch)
tree13e86ec6041d981610f00d15d77085340ad4f6ae /core/io/packet_peer.cpp
parentac58372db824b74b8c4feb948434b924c573b847 (diff)
gdscript_parser: Fix "unreachable code" false positive for loops
Depending on the conditional statements of the 'for' and 'while' loops, their body may not even execute once. For example: func a(): var arr = [] for i in arr: return i # can be reached, but analysis says cannot return -1 func b(): var should_loop = false while should_loop: return 1 # can be reached, but analysis says cannot return 0 The parser will complain that the statements after the comment cannot be reached, but it is clearly possible for our scenario. This is because the parser falsely assumes that the loop body will always execute at least once. Fix the code to remove this assumption for both of those loops.
Diffstat (limited to 'core/io/packet_peer.cpp')
0 files changed, 0 insertions, 0 deletions