Skip to content

#993 PLCgen: First steps in cleaning up the generator backdoor communication

Albert Hofkamp requested to merge 993-refactor-plcgen-name-and-type-gens into develop

This patch removes the name generator and type generator as proper generators and instead passes them into other generators through their constructor.

At least eventually (I am not sure that holds right now) this could also be done when the other generators are called to do their computations but we aren't there yet, and at construction time has the advantage that they can be stored in a private final field.

  • Readable by commit.
  1. Name generator change is change is tricky int the transition generator test. The generators must be created in the target as that handles inter-generator communication, but the transition generator is also needed 'outside' since each test directly calls that generator instead of going through the normal processing.
    • Split the change in 2 steps, which seems good enough.
  2. Type generator change was straightforward then.
  3. Type generator stores its results rather than communicating them to the code storage.
    After pushing however I found that code-storage also use the type generator so copying the type generator results just before the call to code storage is technically not safe.
  4. The type generator results are copied at the appropriate time to the code storage.

End-user visible changes:

  • The order of the declarations in the generated code may be different.

Addresses #993

Edited by Dennis Hendriks

Merge request reports