Skip to content

Commit e133458

Browse files
committed
Move mapped type and enum wrapper declaration before class declaration
The change is to account for templated classes, whose one or more methods depend on a mapped type or an enum. See #66
1 parent ff729f8 commit e133458

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/CodeTree.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -685,15 +685,6 @@ CodeTree::generate_cxx(){
685685

686686

687687
indent(o << "\n", 1) << "throw_if_version_incompatibility();\n\n";
688-
689-
indent(o, 1) << "std::vector<std::shared_ptr<Wrapper>> wrappers = {\n";
690-
std::string sep;
691-
for(const auto& w: wrappers){
692-
indent(o << sep, 2) << "std::shared_ptr<Wrapper>(new" << w << "(jlModule))";
693-
sep = ",\n";
694-
}
695-
o << "\n";
696-
indent(o, 1) << "};\n";
697688

698689
if(type_straight_mapping_.size() > 0){
699690
indent(o, 1) << "// mapping of types that are bit-to-bit matched\n";
@@ -709,6 +700,15 @@ CodeTree::generate_cxx(){
709700
for(const auto& e: enums_){
710701
generate_enum_cxx(o, e.cursor);
711702
}
703+
704+
indent(o, 1) << "std::vector<std::shared_ptr<Wrapper>> wrappers = {\n";
705+
std::string sep;
706+
for(const auto& w: wrappers){
707+
indent(o << sep, 2) << "std::shared_ptr<Wrapper>(new" << w << "(jlModule))";
708+
sep = ",\n";
709+
}
710+
o << "\n";
711+
indent(o, 1) << "};\n";
712712

713713
indent(o, 1) << "for(const auto& w: wrappers) w->add_methods();\n";
714714

0 commit comments

Comments
 (0)