Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] ITranslationUnit and Language Independence

He gang,

 

I’m looking at the multi-language question from the CModel and DOM/Index perspective. As I mentioned in Leo’s Project Model proposal for *DT, my feeling is that the best point of entry into this world is through ITranslationUnit. I have created an interface ILanguage which serves a variety of purposes to allow language specialization of core functionality. I have a method on ITranslationUnit called getLanguage() which would figure out the language given the content type of the file that the TranslationUnit represents. I have an extension point that allows language developers to register an ILanguage implementation against a set of content types. The getLanguage method takes advantage of this extension point. This stuff is in HEAD right now, so you can check it out.

 

The problem I now have is that there is a lot of quasi-language dependant checking in ITranslationUnit, the main one being that ITranslationUnits are only valid for a hard-coded subset of content types. I’d like to get rid of this and add, where really necessary, the behaviour into ILanguage.

 

Any thoughts? Any counter suggestions on how to do this correctly?

Doug.


Back to the top