Closed yuxiaomao closed 3 months ago
I'm not sure if this is good syntax. Should inline functions differ from ordinary ones in their logic? I think it would be better to return a Bool
from it here and do a if (foo(i)) continue;
at the loop level.
Probably not detected by null safety and early returns before too.
Indeed, your syntax makes more sens to me. I'm also surprised by the fact that we can use break / continue inside inline function - before.
Hum but this one does not compile
static public function main() {
for (i in 0...5) {
inline function dothings(v:Int) {
if (v > 3) {
if (v > 4) {
return true; // Error "Cannot inline a not final return"
}
}
if (v > 3 && v > 4) {
return true; // Ok
}
return false;
}
if (dothings(i)) continue;
trace(i);
}
}
Never mind, "inline not final return" error when we have 2 if instead of 1 with && is strange but acceptable, and is not related to this problem.
Recently the following code does not work anymore, with error "Continue outside loop". First bad commit https://github.com/HaxeFoundation/haxe/commit/2b0e8cead3374f0cab8d52ec0ec9b05e269a6750 and related PR https://github.com/HaxeFoundation/haxe/pull/11534, by reading the PR I don't think this is intended.