nasa / fpp

F Prime Prime: A modeling language for F Prime
https://fprime.jpl.nasa.gov
Apache License 2.0
49 stars 31 forks source link

Compute C++ files after checking semantics #149

Closed tiffany1618 closed 2 years ago

tiffany1618 commented 2 years ago

C++ files are computed using the Analysis data structure, but they are being computed before the current Analysis instance is populated by CheckSemantics.tuList(): https://github.com/fprime-community/fpp/blob/98820fe7676752d69bf81775b5666efb4bfd0764/compiler/tools/fpp-to-cpp/src/main/scala/fpp-to-cpp.scala#L38-L47

This causes errors like the following:

An FPP model containing

passive component C {
  enum E { X }
}

enum E { X }

causes fpp-to-cpp to generate a duplicate C++ file error even though there should be no name duplication here (the generated enum classes would be C_E and E).

bocchino commented 2 years ago

Good catch, this looks like an easy fix.