Skip to content

Commit

Permalink
Don't print int* range variables. (#1340)
Browse files Browse the repository at this point in the history
* Add regression test.

* Don't print `int*` range variables.
  • Loading branch information
1uc committed Jul 12, 2024
1 parent 6be1a19 commit 2af37ab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/codegen/codegen_neuron_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,7 @@ void CodegenNeuronCppVisitor::print_mechanism_range_var_structure(bool print_ini
if (name == naming::POINT_PROCESS_VARIABLE) {
continue;
} else if (var.is_index || var.is_integer) {
auto qualifier = var.is_constant ? "const " : "";
printer->fmt_line("{}{}* const* {}{};", qualifier, int_type, name, value_initialize);
// In NEURON we don't create caches for `int*`. Hence, do nothing.
} else {
auto qualifier = var.is_constant ? "const " : "";
auto type = var.is_vdata ? "void*" : default_float_data_type();
Expand Down
18 changes: 18 additions & 0 deletions test/usecases/useion/style_ion.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
: This checks for a code-generation bug that resulted in a faulty ctor
: call. It requires an ion to have a "style", followed by other ions.

NEURON {
SUFFIX style_ion
USEION ca WRITE cai, eca
USEION na READ nai
}

ASSIGNED {
cai
eca
nai
}

INITIAL {
cai = 42.0
}

0 comments on commit 2af37ab

Please sign in to comment.