[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Getting ITranslationUnit from IASTTranslationUnit
|
I'll get John to run the standalone indexer JUnits just to be safe.
===========================
Chris Recoskie
Team Lead, IBM CDT and RDT
IBM Toronto
Sergey Prigogin ---03/25/2011 05:54:02 PM---I ended up adding IASTTranslationUnit.getOriginatingTranslationUnit() method. I decided against the
![]()
From: | ![]()
Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> |
![]()
To: | ![]()
Chris Recoskie/Toronto/IBM@IBMCA |
![]()
Cc: | ![]()
"CDT General developers list." <cdt-dev@xxxxxxxxxxx> |
![]()
Date: | ![]()
03/25/2011 05:54 PM |
![]()
Subject: | ![]()
Re: [cdt-dev] Getting ITranslationUnit from IASTTranslationUnit |
![]()
Sent by: | ![]()
sprigogin@xxxxxxxxxx |
I ended up adding IASTTranslationUnit.getOriginatingTranslationUnit() method. I decided against the adapter approach since a call to getAdapter could inadvertently load the ITranslationUnit class.
-sergey
On Thu, Mar 10, 2011 at 2:03 PM, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
Declaring of an ITranslationUnit field and a getter for that field does not cause loading of ITranslationUnit class until the method is called.
-sergey
On Tue, Mar 8, 2011 at 12:25 PM, Chris Recoskie <recoskie@xxxxxxxxxx> wrote:
I see your point. However, if you create new methods on IASTTranslationUnit that return ITranslationUnit, then there will be a runtime dependency on ITranslationUnit, even if you never call it. That's my concern.
What if, for example, the IASTTranslationUnit could get/set a String workspace path, and also had a boolean get/set for a flag that indicates if it came from the working copy? Would that satisfy your needs? There would be no new dependencies then. You would have to add/change API though to pass on down the path and the flag, but you will be into that anyway if you wanted to pass in the ITranslationUnit because the calls that actually create the IASTTranslation unit are buried pretty deep in the call chain.
===========================
Chris Recoskie
Team Lead, IBM CDT and RDT
IBM Toronto
Sergey Prigogin ---03/08/2011 01:56:12 PM---I'm not proposing making ITranslationUnit a requirement for creation of IASTTranslationUnit. In case
I'm not proposing making ITranslationUnit a requirement for creation of IASTTranslationUnit. In cases when IASTTranslationUnit is created by calling ITranslationUnit.getAST method, the IASTTranslationUnit will remember the originating ITranslationUnit. In other cases the IASTTranslationUnit.getAdaptor(ITranslationUnit.class) will return null.
Mapping from IASTTranslationUnit to ITranslationUnit through IASTFileLocation requires additional knowledge of whether the IASTTranslationUnit originated from a working copy or not. This makes it hard and error prone.
-sergey
On Tue, Mar 8, 2011 at 2:34 AM, Chris Recoskie <recoskie@xxxxxxxxxx> wrote:

