Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lift shared print_top_verbatim_blocks code. #1544

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions src/codegen/codegen_coreneuron_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,28 +346,6 @@ void CodegenCoreneuronCppVisitor::print_abort_routine() const {
/****************************************************************************************/


void CodegenCoreneuronCppVisitor::print_top_verbatim_blocks() {
if (info.top_verbatim_blocks.empty()) {
return;
}
print_namespace_stop();

printer->add_newline(2);
print_using_namespace();

printing_top_verbatim_blocks = true;

for (const auto& block: info.top_verbatim_blocks) {
printer->add_newline(2);
block->accept(*this);
}

printing_top_verbatim_blocks = false;

print_namespace_start();
}


void CodegenCoreneuronCppVisitor::print_function_prototypes() {
if (info.functions.empty() && info.procedures.empty()) {
return;
Expand Down
6 changes: 0 additions & 6 deletions src/codegen/codegen_coreneuron_cpp_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,6 @@ class CodegenCoreneuronCppVisitor: public CodegenCppVisitor {
/****************************************************************************************/


/**
* Print top level (global scope) verbatim blocks
*/
void print_top_verbatim_blocks();


/**
* Print function and procedures prototype declaration
*/
Expand Down
22 changes: 22 additions & 0 deletions src/codegen/codegen_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,28 @@ void CodegenCppVisitor::print_namespace_stop() {
}


void CodegenCppVisitor::print_top_verbatim_blocks() {
if (info.top_verbatim_blocks.empty()) {
return;
}
print_namespace_stop();

printer->add_newline(2);
print_using_namespace();

printing_top_verbatim_blocks = true;

for (const auto& block: info.top_verbatim_blocks) {
printer->add_newline(2);
block->accept(*this);
}

printing_top_verbatim_blocks = false;

print_namespace_start();
}


/****************************************************************************************/
/* Printing routines for code generation */
/****************************************************************************************/
Expand Down
5 changes: 5 additions & 0 deletions src/codegen/codegen_cpp_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,11 @@ class CodegenCppVisitor: public visitor::ConstAstVisitor {
*/
void print_nmodl_constants();

/**
* Print top level (global scope) verbatim blocks
*/
void print_top_verbatim_blocks();


/****************************************************************************************/
/* Overloaded visitor routines */
Expand Down
Loading