GitHub user nwellnhof opened a pull request: https://github.com/apache/lucy-clownfish/pull/78
Add class array to CFCParcel - Move the class registry and the class array in CFCHierarchy to CFCParcel. - Introduce CFCWeakPtr to safely work with circular references. - Add CFCType_get_class. - Improve URI resolution. - Minor cleanups. You can merge this pull request into a Git repository by running: $ git pull https://github.com/nwellnhof/lucy-clownfish cfc-parcel Alternatively you can review and apply these changes as the patch at: https://github.com/apache/lucy-clownfish/pull/78.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #78 ---- commit a86fab47c43ca08883e55e55ff9d10bfc5a5017f Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-27T12:01:16Z Implement CFCWeakPtr We mostly avoided circular references in CFC so far, although it's often useful to have pointers to a parent or ancestor in the tree structures CFC operates on. Weak pointers allow to break circular references when destroying objects. Even after the upcoming changes, CFC won't reference objects through weak pointers after the strong refcount dropped to zero. So we could just use normal pointers and simply don't incref/decref them. The WeakPtr mechanism serves mainly as annotation and safety net, making sure that weak pointers are used as intended. commit e0c9d8b3d26a53379210f33b57a44bcfed38dec6 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-27T15:05:54Z Use WeakPtr in CFCClass Weaken the parcel pointer. This allows to store a class array in CFCParcel later. Also weaken the parent pointer, so that the circular reference doesn't have to be broken manually. commit 7ce20fd218f45f2a647a102e5c1f0d3711f2ee05 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-27T15:58:47Z Use WeakPtr in CFCType Weaken the parcel pointer, allowing to store a class array in CFCParcel later. commit bfd19d209bb8d7088aa42c7cd26b539c283a1005 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-28T15:25:15Z Add CFCClass_in_parcel and CFCClass_in_same_parcel Simple but useful helper functions. commit 22e055c360f32e93103b04814de7c89c8d4c3211 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-26T20:32:58Z Store class array in parcel Store an array of all classes that belong to a parcel in CFCParcel. commit e5b89002ee752aee8563a953b530d4ddafddcf85 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-26T22:11:47Z Sort class arrays of parcels Some of the code generators require that parent classes are processed before subclasses. Sort the class array accordingly when building the hierarchy. Also sort subclasses by class name to guarantee a consistent order. This should make the CFC output completely deterministic. (Except for output that depends on the order of parcels in the global parcel registry. I think the only example is the Perl typemap.) commit e82ee761678b6c60730a819f6f55b09e0a68c898 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-26T23:58:43Z Start to use CFCParcel_get_classes Replace CFCHierarchy_ordered_classes with CFCParcel_get_classes. commit 8971263683dfdf730873ebec50235db5bb895995 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-27T00:23:14Z Remove CFCHierarchy_ordered_classes commit c502223ab7e3c70529352afb42973c9d77e88805 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-27T17:53:58Z Add CFCParcel_class functions Search classes in a parcel by name or struct symbol. In most cases, it's important to only search classes in a parcel or its direct prerequisites. Otherwise, classes from random other parcels could be picked up. commit 850d69bfff9f64dbf1a6a9929639b05bf9cc0fc7 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-27T18:45:52Z Add CFCType_get_class Store a weak pointer to CFCClass in CFCType for object types. commit 1ff6ed0f9ce59fce928d03f0807c47fc57fd501a Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-03-01T13:01:40Z Store CFCClass pointer in parser state Store a CFCClass pointer instead of the class name. commit 81cdda1a5257b27c9f652f54a2e989f18394b150 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-27T22:46:41Z Rework URI resolution Add CFCMethod_get_docucomment to get inherited CFCDocuComment. Use correct base class when resolving URIs. Only search parcel and prereqs for full struct symbols. Also search prereqs for short struct symbols. Search all source parcels and their prereqs for standalone .md documents. Minor cleanups. commit 682278c45ec3f72ace0412317c5e68b16032ec0a Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-27T23:45:46Z Remove global class registry Replaced by the class array in CFCParcel. commit a0e051a0d15658574482b24d328e326c8389670c Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-03-01T13:52:23Z Store CFCClass pointer in CFCMethod Store a weak pointer to the class containing the method. commit a3231bcc2fa05743b8b82c94a04f0df30bf06d97 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-28T13:11:25Z Rework setup of parent/child relationship Set up parent/child relationship of classes in CFCParcel. Connect and sort classes in a single function. Make sure that prereq parcels are registered first. commit 859f5b88cde34e65e563d8a5d7b48a5586230eaa Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-28T13:49:02Z Stop tracking parcels that are inherited from This code was unused. The original idea was to allow circular dependencies between parcels as long as they don't inherit classes from each other. This is an unimportant feature that had to be solved differently, now that we specify prereqs in .cfp files. commit 8fbf9c960b0bcfccedf15a83e6bb7ae1191e2e24 Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-28T14:18:21Z Remove classes array from CFCHierarchy Replaced by class array in CFCParcel. commit 821bf0d0b8c31609ebbc54949f8262ef38393e3a Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-28T15:41:14Z Simplify CFCBindMeth_method_def Remove unneeded static functions. commit bea2a98f994e2a2f5d7cfe1dee1f957d3bb8042e Author: Nick Wellnhofer <wellnho...@aevum.de> Date: 2017-02-28T15:42:08Z Switch some code over to CFCClass_in_parcel ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---