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

Handle identifier collisions in codegen #9

Open
clickingbuttons opened this issue Jun 15, 2023 · 1 comment
Open

Handle identifier collisions in codegen #9

clickingbuttons opened this issue Jun 15, 2023 · 1 comment

Comments

@clickingbuttons
Copy link

Make an identifier string pool per-file to handle naming clashes. Give user fields and enums their function, field, and type identifiers. Then:

  1. Give modules their identifiers
  2. Give inner fields (like _tab: flatbufferz.Table) their identifiers
  3. Give function parameters their identifiers
  4. Give temporary variables their identifiers

This will allow removing _s from field names (like _tab) and temporaries. It will also allow consistently naming the first self: Self parameter.

@travisstaloch
Copy link
Owner

travisstaloch commented Jun 16, 2023

partially addressed in 0a7d9d4

this solution still appends underscores to getters. i was able to prevent a collision between the 'People' namespace and the 'Foo.People()' getter which resulted from https://github.com/travisstaloch/flatbufferz/blob/main/examples/test.fbs.

i know its not ideal to change the getter from 'People()' to 'People_()'. i would rather modify the namespace.

i'll leave this open until i can modify the namespace in a follow up.

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

No branches or pull requests

2 participants