From 8755c35a18c280d02cfbf9e6920021d2dc6f3ab0 Mon Sep 17 00:00:00 2001 From: Anton Bobukh Date: Wed, 29 May 2024 13:16:37 -0700 Subject: [PATCH] [C++] Update the validator to skip structs in namespaces other than the current one. (#8324) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Python] Generate `.pyi` stub files when `--python-typing` is on. To support this change, the following modifications were made: - added a new option to disable `numpy` helpers generation; - added a new flag to control the target Python version: `--python-version` can be one of the following: - `0.x.x` – compatible with any Python version; - `2.x.x` – compatible with Python 2; - `3.x.x` – compatible with Python 3. - added codegen utilities for Python; - added a note that the generated .py file is empty. * [C++] Update the validator to skip structs in namespaces other than the current one. --- src/idl_gen_cpp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index ce03a5eeca5..06571693286 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -470,7 +470,11 @@ class CppGenerator : public BaseGenerator { // Check that nativeName doesn't collide the name of another struct. for (const auto &other_struct_def : parser_.structs_.vec) { - if (other_struct_def == struct_def) { continue; } + if (other_struct_def == struct_def || + other_struct_def->defined_namespace != + struct_def->defined_namespace) { + continue; + } auto other_name = Name(*other_struct_def); if (nativeName == other_name) {