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

Namespaces handling improvements. Share methods between the same name scopes. Do not lookup upper scope for qualified name. #263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TIMONz1535
Copy link

@TIMONz1535 TIMONz1535 commented Apr 19, 2024

I have no idea what I'm doing, I have paws, but I fixed it.

  • Enable allowDuplicates for namespace symbols, so you can declare multiple namespaces with the same name. No more "redefinition" error.
  • Reuse the NamespaceBinder of the first namespace with the current name, so you can share methods between all scopes.
  • When lookup namespace container use the Last one, because it has all members. So don't report "ambiguous" error in that case.
  • Don't extrapolate function lookup to the upper scope for a qualified name, like invoke Shading::Decals::foo but get Shading::foo. Actually we need to check members in the container only, not in the whole binder tree.
  • Lots of tests for the namespace behavior. Correlates with the latest DXC release.

Known issues:
I don't touch anything with struct, enum scopes. Probably it has similar issues.
Don't use nested namespaces with the same name, like namespace Shading { namespace Shading {} } it doesn't work properly.

example

namespace Shading { void foo(int x) {} }
namespace Shading { void foo() {} }
namespace Culling { namespace Decals { void foo(int x) {} } }
namespace Culling { namespace Decals { void foo() {} } }

… scopes. Do not lookup upper scope for qualified name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant