Skip to content

Commit

Permalink
Avoid toggling codegen. (#1116)
Browse files Browse the repository at this point in the history
* Missing newline at end of file.
* Only top-level `print_` toggles `codegen`.
  • Loading branch information
1uc authored Dec 8, 2023
1 parent b6801af commit 1b60785
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/codegen/codegen_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,4 +940,4 @@ void CodegenCppVisitor::visit_program(const Program& node) {
}

} // namespace codegen
} // namespace nmodl
} // namespace nmodl
2 changes: 1 addition & 1 deletion src/codegen/codegen_cpp_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,4 +1173,4 @@ void CodegenCppVisitor::print_vector_elements(const std::vector<T>& elements,
/** \} */ // end of codegen_backends

} // namespace codegen
} // namespace nmodl
} // namespace nmodl
13 changes: 1 addition & 12 deletions src/codegen/codegen_neuron_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ void CodegenNeuronCppVisitor::print_function_prototypes() {
if (info.functions.empty() && info.procedures.empty()) {
return;
}
codegen = true;
/// TODO: Fill in
codegen = false;
}


Expand All @@ -115,9 +112,7 @@ void CodegenNeuronCppVisitor::print_function_or_procedure(const ast::Block& node

/// TODO: Edit for NEURON
void CodegenNeuronCppVisitor::print_function_procedure_helper(const ast::Block& node) {
codegen = true;
/// TODO: Fill in
codegen = false;
return;
}


Expand Down Expand Up @@ -501,16 +496,13 @@ void CodegenNeuronCppVisitor::print_nrn_init(bool skip_init_check) {


void CodegenNeuronCppVisitor::print_nrn_jacob() {
codegen = true;
printer->add_newline(2);
printer->add_line("/** nrn_jacob function */");

printer->fmt_line(
"static void {}(_nrn_model_sorted_token const& _sorted_token, NrnThread* "
"_nt, Memb_list* _ml_arg, int _type) {{}}",
method_name(naming::NRN_JACOB_METHOD));

codegen = false;
}


Expand Down Expand Up @@ -601,7 +593,6 @@ void CodegenNeuronCppVisitor::print_nrn_cur() {
return;
}

codegen = true;
printer->add_newline(2);

printer->fmt_line(
Expand All @@ -610,8 +601,6 @@ void CodegenNeuronCppVisitor::print_nrn_cur() {
method_name(naming::NRN_CUR_METHOD));

/// TODO: Fill in

codegen = false;
}


Expand Down

0 comments on commit 1b60785

Please sign in to comment.