Skip to content

Commit

Permalink
Add support for nested namespaces for C++ (#765)
Browse files Browse the repository at this point in the history
* Add support for nested namespaces for C++

* Improve logic for computing paths to relative files for C++

* Fix lint & CI errors
  • Loading branch information
Walter-Reactor authored Jan 22, 2025
1 parent d7aeba0 commit a49588d
Show file tree
Hide file tree
Showing 23 changed files with 568 additions and 23 deletions.
19 changes: 19 additions & 0 deletions feature_tests/c/include/Nested.d.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions feature_tests/c/include/Nested.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions feature_tests/c/include/Nested2.d.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions feature_tests/c/include/Nested2.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions feature_tests/cpp/include/nested/ns/Nested.d.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions feature_tests/cpp/include/nested/ns/Nested.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions feature_tests/cpp/include/nested/ns2/Nested.d.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions feature_tests/cpp/include/nested/ns2/Nested.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions feature_tests/cpp/tests/attrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
#include "../include/ns/AttrOpaque1Renamed.hpp"
#include "../include/ns/RenamedAttrEnum.hpp"
#include "../include/Unnamespaced.hpp"
#include "../include/nested/ns/Nested.hpp"
#include "../include/nested/ns2/Nested.hpp"
#include "assert.hpp"

int main(int argc, char *argv[]) {
int main(int argc, char *argv[])
{
std::unique_ptr<ns::AttrOpaque1Renamed> r = ns::AttrOpaque1Renamed::totally_not_new();
simple_assert_eq("method should call", r->method_renamed(), 77);
simple_assert_eq("method should call", r->abirenamed(), 123);

// These C names should also resolve
void* renamed = (void*)ns::capi::renamed_on_abi_only;
std::cout<<"Renamed function at "<<renamed<<std::endl;
renamed = (void*)ns::capi::namespace_AttrOpaque1_method;
std::cout<<"Renamed function at "<<renamed<<std::endl;
void *renamed = (void *)ns::capi::renamed_on_abi_only;
std::cout << "Renamed function at " << renamed << std::endl;
renamed = (void *)ns::capi::namespace_AttrOpaque1_method;
std::cout << "Renamed function at " << renamed << std::endl;

ns::RenamedAttrEnum e = ns::RenamedAttrEnum::A;

Expand Down
28 changes: 28 additions & 0 deletions feature_tests/dart/lib/src/RenamedNested.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions feature_tests/dart/lib/src/RenamedNested2.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions feature_tests/dart/lib/src/lib.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions feature_tests/js/api/RenamedNested.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a49588d

Please sign in to comment.