From 7dd5d2ecdc501ff613f6a3876ec78e0a6daf8bd6 Mon Sep 17 00:00:00 2001 From: Soroush Bateni Date: Sun, 10 Apr 2022 00:06:00 -0500 Subject: [PATCH] Fixed an issue with bank_index Where bank_index was not being generated unless the user explicitly added it as a reactor property --- .../org/lflang/generator/python/PythonReactorGenerator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/python/PythonReactorGenerator.java b/org.lflang/src/org/lflang/generator/python/PythonReactorGenerator.java index 4b5549b738..be06af5254 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonReactorGenerator.java +++ b/org.lflang/src/org/lflang/generator/python/PythonReactorGenerator.java @@ -167,10 +167,10 @@ private static String generatePythonClassInstantiation(ReactorInstance instance, CodeBuilder code = new CodeBuilder(); code.pr(PyUtil.reactorRef(instance)+" = _"+className+"("); code.indent(); + // Always add the bank_index + code.pr("_bank_index = "+PyUtil.bankIndex(instance)+","); for (ParameterInstance param : instance.parameters) { - if (param.getName().equals("bank_index")) { - code.pr("_bank_index = "+PyUtil.bankIndex(instance)+","); - } else { + if (!param.getName().equals("bank_index")) { code.pr("_"+param.getName()+"="+PythonParameterGenerator.generatePythonInitializer(param)+","); } }