Details
Description
add the "partial" modifier to type definitions such that you can spread the defintion of a class accross multiple physical files. example:
in SomeClass-1.boo
partial class SomeClass:
field1 as string
field2 as string
def someOp():
someOpInSecondFile()
def someOpInFirstFile():
pass
in SomeClass-2.boo
partial class SomeClass:
def someOpInSecondFile():
someOpInFirstFile()
Attachments
Issue Links
| This issue is related to: | ||||
| BOO-402 | Add information to duplicate name on types |
|
|
|
I've completed work to enable this feature and will commit it pending community approval. The behavior is as follows:
-only class defintions (i.e. not structs, interfaces, or enums) can be declared partial.
-partial classe defintions can appear in the same file, in different files, or both.
-Nodes from all the files are simply concatenated together, so that if you declare foo() in 2 partial classes, the error will read like you had declared the same function within one traditional definition.
-You can declare base classes or interface implementations on any of the partial class definitions. All such declarations will be unioned, that is, the following is valid:
partial class foo (someInterface):
pass
partial class foo (someInterface, someInterface2):
pass
the merged class foo will implement both someInterface and someInterface2. If 2 or more different base classes are declared in each partial definition an error will be thrown just like you had declared 2 base classes in a full definition.