Add support for partial classes
Submitted by Simon Werbeck
Link to original bug (#696995)
Description
Created attachment 240254 Add support for partial classes
This patch adds support for partial class definitions across multiple source files. The implementation merges all subsequent parts into the first encountered, much like vala already does for namespaces. In the generated vapi the class appears as complete type (no 'partial'). From IRC:
20:35 < bronzebeard>
i just now wrote an implementation for partial classes, is there a specific reason not to support such a feature or is it
ok to file a bug?
20:35 <@nemequ> not yet. i'll push it to git in a minute.
20:36 <@nemequ> bronzebeard, iirc there is already a bug about it, but yes, there are several reasons not to support them.
20:36 <@nemequ> bronzebeard, it's under (slow) debate, but if you have something working you should definitely attach it
...
20:55 <@nemequ> bronzebeard, so it doesn't work across multiple valac invocations.
20:55 < bronzebeard>
nemequ, you mean i.e fast-vapis?
20:55 <@nemequ> i mean separate projects
20:56 <@nemequ> or multiple valac calls within the same project
Not sure I understand correctly, but this is what the C#-Programming Guide says: - All partial-type definitions meant to be parts of the same type must be defined in the same assembly and the same module (.exe or .dll file). - Partial definitions cannot span multiple modules.
Things that still need to be done:
- base types: if the same base-type appears in two partial classes, both are added to the list. Currently the symbol resolver doesn't check for duplicate base-types. This should probably be a separate bug.
Patch 240254, "Add support for partial classes":
0001-Add-support-for-partial-classes.patch