CompilationUnit Clone [message #254121] |
Sat, 21 June 2008 02:03  |
Eclipse User |
|
|
|
Hi,
I would like to make a clone/copy of a compilationunit before it goes
through the resolve() method. Later I would use the copied/cloned version
for future work. Ideally this copy should not have any information that
has been changed during the resolve phase of the original unit. I require
to call the resolve method.
Could you pleas help.
Thanks in advance
Amritam
MS student
|
|
|
|
|
Re: CompilationUnit Clone [message #254231 is a reply to message #254157] |
Wed, 25 June 2008 00:41   |
Eclipse User |
|
|
|
"Amritam" <amritamsarcar@yahoo.co.in> wrote in message
news:a9d38b36a49e6af77d192e91d47cdc14$1@www.eclipse.org...
> What I am trying to do is runtime assertion checking. For this I am
> generating RAC after the resolve(type checking phase). After the
> generation of RAC code (in source code format) I am now sending this code
> for scanning and parsing and also type binding. What I do here is actually
> parse only this new code(RAC) and then I mutate with the original AST.
> After this I call the resolve (type check) on this modified AST and I
> should be getting the code to work properly.
> Hence during the first round I require typechecked parse tree however in
> the second round when I mutate I require only the parsetree. My experience
> says that if I mutate on the typechecked tree, it gives some compile time
> error (since my guess, which I am pretty much sure, is this resolve phase
> expects untyped parse tree).
> Presently, to test whether this actually works, I have actually generated
> RAC before typechecking (which should not be the case), and it works fine.
> However when generate RAC code after typechecking, I get some errors. They
> are basically errors of statements which have already been typechecked.
> Please help. I was also thinking whether I can clone the AST and then form
> a new CU.
I'm afraid you're a bit over my head here. Perhaps someone else from JDT
will respond?
My thought would be to treat it like refactoring does - create a new
WorkingCopyOwner, and open the compilation units into that owner for the
sake of temporarily modifying them without colliding with the rest of the
typesystem. So, you might want to take a detailed look at the refactoring
code in JDT, e.g. the org.eclipse.jdt.internal.corext.refactoring package.
|
|
|
Re: CompilationUnit Clone [message #254247 is a reply to message #254231] |
Thu, 26 June 2008 03:13  |
Eclipse User |
|
|
|
When typechecking(resolve) phase was implemented I presume it was done
with this in mind , that this method would be called once ie. for each
compilation unit, only once it would be called
Is it also true that the typechecking phase assumes that the input to this
phase is (untype-checked) AST.
However can I send an AST (or CU) where some of the methods and the CU
itself has been typechecked while some of them have not. Would these
methods which are not typechecked be currectly processed.
|
|
|
Powered by
FUDForum. Page generated in 0.04701 seconds