I have reworked some of the code related to c++-templates and I am going to commit my changes. I'd like to explain what I have done: Extended API: IBinding.getOwner() ================================= When dealing with specializations it is helpful to be able to obtain the binding in which another binding is contained. Up to now there were a couple of workarounds like: IBinding.getScope().getName().resolveBinding(), or ((ICPPClassScope) IBinding.getScope()).getClassType() to do that. None of these works for all cases, I have created a new method for that. Removed triplicated code: ========================= The algorithms for template instantiation was spread apart into the 3 implementations of the binding hierarchy. I reorganized the code to have the algorithms in one place (CPPTemplates). The algorithms now work with any of the 3 binding implementations. Specialization vs. Instance: ============================ In many aspects instances behave like specializations, why one can live with the iheritance from ICPPTemplateInstance of ICPPSpecialization. An instance is created off a template and lives in the same scope as the template. Specializations are created on behalf of a class-specialization or class-instance and belong to their creator. By that you can see that the argument map in a specialization is redundant information that could be obtained from the parent, whereas in an instance the arguments are significant to distinguish between different instances. * Explicit specializations are instances in the above sense, therefore I changed the code to model them as instances. * I changed the type-comparison. * I made sure instances and specializations are created once, only. JUnit failure: ============== I have broken the JUnit-tests for anonymous members of c-structs or unions, I will look into that soon. bug 216791 and 206450. Patch: ====== Although I am going to commit my changes right away, I'll attach a patch to bug 236197, if there is a need to revert any of my changes. Markus.
Back to the top