lingua-franca icon indicating copy to clipboard operation
lingua-franca copied to clipboard

Parameterized mutable multiport inputs does not work

Open erlingrj opened this issue 1 year ago • 0 comments

target C;
reactor R(width:int=4) {
  mutable input[width] in: int
  reaction(in) {==}
}
main reactor {
  r = new R()
}

gives:

/home/erling/dev/examples-lingua-franca/src-gen/MutablMultiport/_r.c: In function ‘_rreaction_function_0’:
/home/erling/dev/examples-lingua-franca/src-gen/MutablMultiport/_r.c:11:24: error: ‘width’ undeclared (first use in this function)
   11 |     _r_in_t _lf_tmp_in[width];
      |                        ^~~~~
/home/erling/dev/examples-lingua-franca/src-gen/MutablMultiport/_r.c:11:24: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [CMakeFiles/MutablMultiport.dir/build.make:104: CMakeFiles/MutablMultiport.dir/_r.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/MutablMultiport.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
lfc: error:  failed with error code 2
lfc: fatal error: Aborting due to 1 previous error.

The problem appears to be that the code-generator just uses the parameter directly, it should be prepended with self.

erlingrj avatar Nov 23 '23 16:11 erlingrj