jdeans289 / icg2

Interface Code Generator 2: Electric Boogaloo
Other
0 stars 2 forks source link

Inheritance Support #4

Closed jdeans289 closed 10 months ago

jdeans289 commented 1 year ago

We need to be able to support inherited classes.

I can see a 2 basic approaches to this, and it will take some exploration to see what will work better:

  1. Add all members of a base class directly to CompositeDataType's member list.
    • At ICG time? This probably requires more work in ICG than we may want to on understanding an resolving types, but it will make the structure of any given CompositeType as close to what would actually be going on under the hood.
    • Maybe it could be done at dictionary validation time. Still need to determine when that is.
  2. Add a list of CompositeType * to CompositeType to represent the bases classes (only track 1 level at a time, but it would have to be a list to support multiple inheritance).
    • Might make traversing the types in visitors a lot clunkier, but would probably be easier to implement on the ICG side.

Maybe some mix of these two things? ICG can establish the inheritance links, and then the CompositeTypes can pull in all their base class members at validation time.

Things to watch out for - the dreaded diamond inheritance problem.

jdeans289 commented 10 months ago

Closed by #44