From: Baptiste L. <gai...@fr...> - 2003-04-23 19:47:39
|
Well done. I hadn't though it was possible to use the CodeModel for actual code transformation yet For notes, The ASTNode should disappears from the Refactoring, and the IdentifierResolver will be rewritten using the CodeModel. That way code analysis and transformation will only deal with a fairly clearly defined CodeModel. Notes that the unit test CodeModelGeneratorTest::testFunctionPointer fails because function pointer are not recognized (yet) as variable declaration (meaning that the produced is not of the correct type). Baptiste. ----- Original Message ----- From: "Sven Reichard" <rei...@ma...> To: "CppTool Mailing List" <Cpp...@li...> Sent: Monday, April 21, 2003 5:19 AM Subject: [Cpptool-develop] new refactoring > In order to understand the code model component, I tried to implement a > silly little refactoring which I would call SplitDeclaration. Basically, > it transforms something like > { > double *x, y[3], &z; > } > to > { > double *x; > double y[3]; > double &z; > } > This is useful if e.g., we want to modify the declaration of one of the > variables, like make it const. It also avoids one common mistake, namely > > int* x, y; // these are not two pointers > > It is fully implemented using the code model, though the code is still a > bit ugly, since I haven't gotten used to dealing with shared pointers yet. > I will clean it up a bit before committing it. > > In order to make it run, I had to modify the way declaration expressions > are handled in the model/rewriter. I committed the changes, as well as the > tests that made them necessary. > > As I said, the main purpose was to understand the code model, and I start > to like it :) I still have a few questions, but they can wait until > Baptiste gets back. > > More later, > Sven. > > -- > Sven Reichard > Dept. of Math. Sci. > University of Delaware > rei...@ma... |