From: Sven R. <rei...@ma...> - 2002-11-13 19:18:55
|
I got rename temp to use the expr mutator. As a consequence, all existing tests pass now. However, the code is a bit of a mess; I'll try to clean it up. This should probably use a node/property visitor, but their mechanics isn't clear to me yet. Also, I suspect it won't work with some types of statements; tested so far are declarations, return, and expression statements. Cheers, Sven. -- Sven Reichard Dept. of Math. Sci. University of Delaware rei...@ma... |
From: Baptiste L. <gai...@fr...> - 2002-11-16 08:04:05
|
I'll take the visitor. It's really just like the VariableDeclVisitor. Baptiste. ----- Original Message ----- From: "Sven Reichard" <rei...@ma...> To: "CppTool Mailing List" <Cpp...@li...> Sent: Wednesday, November 13, 2002 8:18 PM Subject: [Cpptool-develop] update > I got rename temp to use the expr mutator. As a consequence, all existing > tests pass now. However, the code is a bit of a mess; I'll try to clean it > up. This should probably use a node/property visitor, but their mechanics > isn't clear to me yet. Also, I suspect it won't work with some types of > statements; tested so far are declarations, return, and expression > statements. > > Cheers, > Sven. > > -- > Sven Reichard > Dept. of Math. Sci. > University of Delaware > rei...@ma... > > > > ------------------------------------------------------- > This sf.net email is sponsored by: Are you worried about > your web server security? Click here for a FREE Thawte > Apache SSL Guide and answer your Apache SSL security > needs: http://www.gothawte.com/rd523.html > _______________________________________________ > Cpptool-develop mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cpptool-develop > > |
From: Baptiste L. <gai...@fr...> - 2002-11-16 11:26:23
|
I'm just done adding the ExpressionMutator to the MaxLODMutator. astdump now show identifiers in expressions. I also fixed a serious bug: the starting index of the identifier node was based on the expression starting index instead of the source (the test that was supposed to detect this was buggy). I fixed the RenameTempRefactoring that was based on this bug. Node indexes are always source based. I also fixed another bug revealed by using astdump: true, false and this were recognized as identifier with they are not. Also, the ExpressionMutator now creates localScopeIdentifier child nodes instead of variableIdentifier child nodes. Identifiers found in an expression could also be member functions, hence the renaming. Baptiste. ----- Original Message ----- From: "Baptiste Lepilleur" <gai...@fr...> To: "Sven Reichard" <rei...@ma...>; "CppTool Mailing List" <Cpp...@li...> Sent: Saturday, November 16, 2002 9:09 AM Subject: Re: [Cpptool-develop] update > I'll take the visitor. It's really just like the VariableDeclVisitor. > > Baptiste. > > ----- Original Message ----- > From: "Sven Reichard" <rei...@ma...> > To: "CppTool Mailing List" <Cpp...@li...> > Sent: Wednesday, November 13, 2002 8:18 PM > Subject: [Cpptool-develop] update > > > > I got rename temp to use the expr mutator. As a consequence, all existing > > tests pass now. However, the code is a bit of a mess; I'll try to clean it > > up. This should probably use a node/property visitor, but their mechanics > > isn't clear to me yet. Also, I suspect it won't work with some types of > > statements; tested so far are declarations, return, and expression > > statements. > > > > Cheers, > > Sven. > > > > -- > > Sven Reichard > > Dept. of Math. Sci. > > University of Delaware > > rei...@ma... > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by: Are you worried about > > your web server security? Click here for a FREE Thawte > > Apache SSL Guide and answer your Apache SSL security > > needs: http://www.gothawte.com/rd523.html > > _______________________________________________ > > Cpptool-develop mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cpptool-develop > > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: To learn the basics of securing > your web site with SSL, click here to get a FREE TRIAL of a Thawte > Server Certificate: http://www.gothawte.com/rd524.html > _______________________________________________ > Cpptool-develop mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cpptool-develop > > |
From: Sven R. <rei...@ma...> - 2002-11-16 17:30:38
|
On Sat, 16 Nov 2002, Baptiste Lepilleur wrote: > I'm just done adding the ExpressionMutator to the MaxLODMutator. astdump now > show identifiers in expressions. I also fixed a serious bug: the starting > index of the identifier node was based on the expression starting index > instead of the source (the test that was supposed to detect this was buggy). I kind of suspected that this was a bug, but I didn't feel confident enough to change it. I'll check out the sources when I get to it. Things are starting to look good :) Sven. |
From: Baptiste L. <gai...@fr...> - 2002-11-19 12:31:46
|
----- Original Message ----- From: "Sven Reichard" <rei...@ma...> To: "CppTool Mailing List" <Cpp...@li...> Sent: Saturday, November 16, 2002 6:30 PM Subject: Re: [Cpptool-develop] update > On Sat, 16 Nov 2002, Baptiste Lepilleur wrote: > > > I'm just done adding the ExpressionMutator to the MaxLODMutator. astdump now > > show identifiers in expressions. I also fixed a serious bug: the starting > > index of the identifier node was based on the expression starting index > > instead of the source (the test that was supposed to detect this was buggy). > > I kind of suspected that this was a bug, but I didn't feel confident > enough to change it. I'll check out the sources when I get to it. Things Don't hesiate to express your doubt, I've never eaten anyone ;-) > are starting to look good :) Indeed. The next step will be dealing with scope I guess. I'll try finalizing the vc6addin before though. There is no better test than real-life usage ;-). Baptiste. > > Sven. |
From: Sven R. <rei...@ma...> - 2002-11-19 15:56:25
|
On Tue, 19 Nov 2002, Baptiste Lepilleur wrote: > Don't hesiate to express your doubt, I've never eaten anyone ;-) ok :) > > > are starting to look good :) > Indeed. The next step will be dealing with scope I guess. I'll try > finalizing the vc6addin before though. There is no better test than > real-life usage ;-). Fine with me. I'm currently quite busy with my thesis, so my input will be minimal for the next week or so. However, I'll think about a simple QT interface. About the scope: I assume you refer to another variable with the same name being defined in a subscope. This could be dealt with by - detecting such a variable; - renaming that "inner variable" to some silly name; - renaming the outer variable; - restoring the original name for the inner variable. (However, even if we don't deal with this case, it won't break the program.) The only thing we need to be careful about is the outer variable appearing in the initializer of the inner variable. I still have to check carefully if that is correct code. I mean something like this: { double x = 3.14; { int x = std::floor(x); } } In this case, the argument to floor is really the outer variable. Cheers, Sven. -- Sven Reichard Dept. of Math. Sci. University of Delaware rei...@ma... |
From: Baptiste L. <gai...@fr...> - 2002-11-20 09:00:24
|
----- Original Message ----- From: "Sven Reichard" <rei...@ma...> To: "CppTool Mailing List" <Cpp...@li...> Sent: Tuesday, November 19, 2002 4:56 PM Subject: Re: [Cpptool-develop] update > On Tue, 19 Nov 2002, Baptiste Lepilleur wrote: > > Don't hesiate to express your doubt, I've never eaten anyone ;-) > ok :) > > > > > are starting to look good :) > > Indeed. The next step will be dealing with scope I guess. I'll try > > finalizing the vc6addin before though. There is no better test than > > real-life usage ;-). > > Fine with me. I'm currently quite busy with my thesis, so my input will be > minimal for the next week or so. However, I'll think about a simple QT > interface. > > About the scope: I assume you refer to another variable with the same name > being defined in a subscope. This could be dealt with by > - detecting such a variable; > - renaming that "inner variable" to some silly name; > - renaming the outer variable; > - restoring the original name for the inner variable. Actually, I'd rather deal with it in a cleaner way. We will need to correctly resolve scope in the future to apply some refactorings. Having a working solution at function body level will make it easier to find a solution working at class level, and later at any level... The step I have in my head at the current time are more along: - assign a scope to each 'scope creator' statement (not well defined, but something like for, if, while, declaration, ...) and create a scope 'hierarchy' (will probably become a graph when extended to deal with global variable, anonymous namespace and class) - assign a scope to each declared variable (usually from the variable-decl-statement to the end of the parent node, with the exception of the variable initialization on declaration) - resolve the scope of each variable occurrences (local-scope-identifier and variable-identifier node). Scope is 'not local' if the variable is unknown (might be a parameter, class member, or global). - apply the renaming only on variable with the same scope as the renamed temporary. I'll try to add a CodeAnalysisForRefactoring page to the wiki today. Baptiste. > (However, even if we don't deal with this case, it won't break the > program.) > The only thing we need to be careful about is the outer variable appearing > in the initializer of the inner variable. I still have to check carefully > if that is correct code. I mean something like this: > { > double x = 3.14; > { > int x = std::floor(x); > } > } > > In this case, the argument to floor is really the outer variable. > > Cheers, > Sven. > > -- > Sven Reichard > Dept. of Math. Sci. > University of Delaware > rei...@ma... > > > > ------------------------------------------------------- > This sf.net email is sponsored by: To learn the basics of securing > your web site with SSL, click here to get a FREE TRIAL of a Thawte > Server Certificate: http://www.gothawte.com/rd524.html > _______________________________________________ > Cpptool-develop mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cpptool-develop > |