Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CppHeaderParser cant distinguish two classes with the same name in different namespaces #54

Open
@PBCOnGit

Description

Basically what the title says, but here is an example:
CppHeaderParser will fail to parse code like below:

namespace i {
	struct Human {
		int t1;
	};
}
namespace w {
	struct Human {
		int t2;
	};
}

The issue is caused by the following code:

if not key.endswith("::") and not key.endswith(" ") and len(key) != 0:
 if key in self.classes:
 race_print("ERROR name collision:", key)
 self.classes[key].show()
 newClass.show()
 assert key not in self.classes # namespace collision

inside _CppHeader::_evaluate_class_stack
Sadly im not sure if there is any easy way to fix this problem since it is actually caused by the fact that CppHeaderParser doesn't include normal namespaces in the name of a class.
A possible fix would be to include the namespace in the name as well which would force everyone to rewrite their code.
Another possible fix would be to distinguish between classes with a unique hash which also includes the namespace.
Edit: Add example and fix code indention

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /