PLC-lang / rusty

Structured Text Parser and LLVM Frontend
GNU Lesser General Public License v3.0
181 stars 47 forks source link

Program calls without parentheses #1180

Open mhasel opened 1 month ago

mhasel commented 1 month ago

In the past we've often discussed action calls without parentheses and what to do about it going forward. I've now stumbled on a similar use of programs without parentheses while migrating an old project. But contrary to action calls, these statements will not trigger an error during validation/codegen and be generated simply as a load of the program instance. Therefore it is easy to miss these statements and the runtime behaviour of your project will change drastically. Unfortunately it isn't as easy as just extending the validation-method that worked for actions (#1170), because programs have stateful member-variables which can also be accessed like a struct. So a statement like x := myProg.myVar would trigger false-positives.