OceanParcels / Parcels

Main code for Parcels (Probably A Really Computationally Efficient Lagrangian Simulator)
https://www.oceanparcels.org
MIT License
295 stars 136 forks source link

Nested if-loops not working? #1233

Closed erikvansebille closed 2 years ago

erikvansebille commented 2 years ago

As reported by @VeckoTheGecko in #1232, it seems nested if-loops are not always correctly parsed in the codeconverter.py. Would be good to either fix this; or to throw a warning if Kernels contain nested if-loops

erikvansebille commented 2 years ago

Actually, nested if-loops seem to be working fine. There was already a unit-test (see below) that has been working fine since #538, more than three years ago

https://github.com/OceanParcels/parcels/blob/7f6610417c948e85d65d98704db36e55e505b5a7/tests/test_kernel_language.py#L130-L144

So not sure why @VeckoTheGecko experiences breaking nested if-statements. Could you provide a minimal breaking example code?

VeckoTheGecko commented 2 years ago

I've noted down the commit in my workspace, but a bit time poor to provide a minimal example. Will look at it at a later date and followup.