Bug - Fixed Imported files added to Parser.imports too late

fredg1

Member
In order to prevent infinite loops in case of mutual imports, they need to be added BEFORE the parsing begins.

Tested.
 

Attachments

  • recursion_prevention.patch
    683 bytes · Views: 1

MCroft

Developer
Staff member
Fred and I discussed this last night, and it prevents a circular reference issue that locks up KoLmafia in a tight little loop of "A.ash:import B.ash", "B.ash:import A.ash". Probably would eventually crash, but we didn't wait that long. Swapped order on a test, and all seems well.

Lightly tested with a few real world scripts and new test cases A->B->A as well as A->B->C->A

This probably never actually happens, but now it can't and the functionality matches the documentation.


r20746
 
Top