You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(15) |
Feb
(26) |
Mar
(97) |
Apr
(224) |
May
(226) |
Jun
|
Jul
(3) |
Aug
(22) |
Sep
(48) |
Oct
|
Nov
|
Dec
(38) |
2004 |
Jan
(28) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(37) |
Jul
|
Aug
(73) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <net...@us...> - 2003-04-26 10:52:03
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv20978/src/rftaparser Modified Files: Parser.cpp Log Message: -- additional function for scanning character sequences Index: Parser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/Parser.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Parser.cpp 12 Apr 2003 19:05:16 -0000 1.6 --- Parser.cpp 26 Apr 2003 10:51:59 -0000 1.7 *************** *** 205,208 **** --- 205,219 ---- } + bool + Parser::tryReadNext( std::string s) + { + int idx = 0; + if (s.empty()) return true; + while ( hasNext() && idx<s.length() && *current_ == s[idx] ) + { + ++idx; ++current_; + } + return idx==s.length(); + } bool |
From: <net...@us...> - 2003-04-26 10:52:03
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv20978/include/rfta/parser Modified Files: Parser.h Log Message: -- additional function for scanning character sequences Index: Parser.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/Parser.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Parser.h 12 Apr 2003 19:09:27 -0000 1.5 --- Parser.h 26 Apr 2003 10:51:58 -0000 1.6 *************** *** 92,95 **** --- 92,96 ---- void expect( char c ); bool tryNextIs( char c ); + bool tryReadNext( std::string s); void readUntilNextSemiColonSkippingOverCurlyBraces(); |
From: <net...@us...> - 2003-04-26 10:51:01
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv20636/src/rftaparser Modified Files: ParserTesting.h Log Message: -- bug fix (missing comma) Index: ParserTesting.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ParserTesting.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ParserTesting.h 27 Oct 2002 16:59:36 -0000 1.3 --- ParserTesting.h 26 Apr 2003 10:50:58 -0000 1.4 *************** *** 209,213 **** #define RFTA_ASSERT_NODE_TYPE( node, type ) \ ! Refactoring::Testing::checkASTNodeType( node, type \ CPPUNIT_SOURCELINE(), \ #node ) --- 209,213 ---- #define RFTA_ASSERT_NODE_TYPE( node, type ) \ ! Refactoring::Testing::checkASTNodeType( node, type, \ CPPUNIT_SOURCELINE(), \ #node ) |
From: <net...@us...> - 2003-04-26 10:50:20
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv20361/src/rftaparser Modified Files: DeclarationParserTest.h DeclarationParserTest.cpp DeclarationParser.cpp Log Message: -- removed parsing of "typedef" within this context (moved to unparsed-declaration-mutator) Index: DeclarationParserTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParserTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DeclarationParserTest.h 12 Apr 2003 19:08:40 -0000 1.1 --- DeclarationParserTest.h 26 Apr 2003 10:50:16 -0000 1.2 *************** *** 20,24 **** CPPUNIT_TEST( testNamespaceParse ); CPPUNIT_TEST( testUsingNamespace ); - CPPUNIT_TEST( testGlobalTypedef ); CPPUNIT_TEST( testLongUsingNamespace ); CPPUNIT_TEST( testNamespaceAlias ); --- 20,23 ---- *************** *** 46,50 **** void testNamespaceParse(); void testUsingNamespace(); - void testGlobalTypedef(); void testLongUsingNamespace(); void testNamespaceAlias(); --- 45,48 ---- Index: DeclarationParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParserTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DeclarationParserTest.cpp 15 Apr 2003 19:05:18 -0000 1.3 --- DeclarationParserTest.cpp 26 Apr 2003 10:50:17 -0000 1.4 *************** *** 116,134 **** void - DeclarationParserTest::testGlobalTypedef() - { - const std::string source( " typedef struct x { int a; } x__; " ); - int startIndex = 1; - int endIndex = 33; - SourceASTNodePtr sourceAST = RFTA_ASSERT_PARSER_PASS( DeclarationParser, - source, - source.length()-2 ); - RFTA_ASSERT_NODE_HAS( sourceAST->getChildAt(0), - ASTNodeTypes::typedefStatement, - startIndex, - endIndex-startIndex ); - } - - void DeclarationParserTest::testSimpleLinkage() { --- 116,119 ---- Index: DeclarationParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParser.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DeclarationParser.cpp 15 Apr 2003 19:05:17 -0000 1.3 --- DeclarationParser.cpp 26 Apr 2003 10:50:17 -0000 1.4 *************** *** 157,169 **** current_ = parser.getCurrent(); return true; ! } ! else if ( "typedef" == identifier ) ! { ! // call typedef parser ! TypeDeclarationStatementParser parser( context_, start , end_ ); ! parser.parse(current_); ! current_ = parser.getCurrent(); ! return true; ! } else if ( "namespace" == identifier ) { --- 157,161 ---- current_ = parser.getCurrent(); return true; ! } else if ( "namespace" == identifier ) { |
From: <net...@us...> - 2003-04-26 10:47:59
|
Update of /cvsroot/cpptool/rfta/doc In directory sc8-pr-cvs1:/tmp/cvs-serv19544/doc Modified Files: AbstractSyntaxSTreeStructure.txt Log Message: -- updated documentation for declaration parsing Index: AbstractSyntaxSTreeStructure.txt =================================================================== RCS file: /cvsroot/cpptool/rfta/doc/AbstractSyntaxSTreeStructure.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractSyntaxSTreeStructure.txt 16 Apr 2003 18:43:01 -0000 1.7 --- AbstractSyntaxSTreeStructure.txt 26 Apr 2003 10:47:56 -0000 1.8 *************** *** 56,59 **** --- 56,97 ---- // mutation not yet defined + * Declaration-Level-Elements + + // each declaration consists of a list of specifier and a list of declarators (with optional init) + [declaration] + declaration-specifiers-property => [declaration-specifier-list] // type specifiers + n [init-declarator] // each declaration can declare 'n' identifier + + [declaration-specifier-list] + n [{declaration-specifier}] , + + [init-declarator] + ?initializer-property => [expression] + declarator-property => [unparsed-declarator] , [declarator] + + [unparsed-declarator] + variable-name-property => [#variable-identifier-expression] + #mutate: declarator + + [declarator] + variable-name-property => [#variable-identifier-expression] + ?sub-declarator-property => [declarator] // declarators are organized hierarchical + declarator-type-property => + [function-declarator], // ... (...) + [array-declarator] // ... [...] + [#braces] // (...) + [ptr-declarator] // * ... + [#declarator-identifier] // user::x + + {declaration-specifier} + [#simple-type-specifier] // "simple-type-specifier" (char, wchar_t, bool, etc.) also "cv-qualifier" ---> see C++ Spec. + [class-specifier] // full class spec: "class x { ... }" (struct, union and class keyword is allowed) + [enum-specifier] // full enum spec + [elaborated-type-specifier] // something like "class xxx", "struct y" or simply "UserTypePtr" + + [ptr-declarator] + ?ptr-declarator-property => [#unparsed] + ?nested-name-property => [#declarator-identifier] + * Statements a function/method body level |
From: <net...@us...> - 2003-04-26 10:47:04
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv19224/src/rftaparser Modified Files: ASTNodes.cpp Log Message: -- additional nodes/properties for declaration parsing Index: ASTNodes.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ASTNodes.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ASTNodes.cpp 15 Apr 2003 19:05:14 -0000 1.18 --- ASTNodes.cpp 26 Apr 2003 10:47:00 -0000 1.19 *************** *** 25,28 **** --- 25,36 ---- /* AB: NEW */ const ASTNodeType ASTNodeTypes::unparsedTemplateHeader ( "unparsed-template-header", mayHaveLocalScopeIdentifierChildren ); + /* AB: NEW */ const ASTNodeType ASTNodeTypes::declaration ( "declaration" , 0 ); + /* AB: NEW */ const ASTNodeType ASTNodeTypes::declarationSpecifierList ( "declaration-specifier-list" , 0 ); + /* AB: NEW */ const ASTNodeType ASTNodeTypes::simpleTypeSpecifier ( "simple-type-specifier" , 0 ); + /* AB: NEW */ const ASTNodeType ASTNodeTypes::classSpecifier ( "class-specifier" , 0 ); + /* AB: NEW */ const ASTNodeType ASTNodeTypes::enumSpecifier ( "enum-specifier" , 0 ); + /* AB: NEW */ const ASTNodeType ASTNodeTypes::elaboratedTypeSpecifier ( "elaborated-type-specifier" , 0 ); + /* AB: NEW */ const ASTNodeType ASTNodeTypes::unparsedDeclarator ( "unparsed-declarator" , 0 ); + const ASTNodeType ASTNodeTypes::unparsedCompoundStatement( "unparsed-compound-statement", isCompositeStatement | needMutation ); const ASTNodeType ASTNodeTypes::compoundStatement( "compound-statement", isCompositeStatement ); *************** *** 95,98 **** --- 103,107 ---- const ASTNodeProperty ASTNodeProperties::typeDeclSeparator( "type-decl-separator-property" ); + /* properties for declarations */ /* AB: NEW */ const ASTNodeProperty ASTNodeProperties::templateBodyProperty( "template-body-property" ); /* AB: NEW */ const ASTNodeProperty ASTNodeProperties::templateHeaderProperty( "template-header-property" ); *************** *** 102,105 **** --- 111,116 ---- /* AB: NEW */ const ASTNodeProperty ASTNodeProperties::functionBodyProperty( "function-body-property" ); /* AB: NEW */ const ASTNodeProperty ASTNodeProperties::functionHeaderProperty( "function-header-property" ); + + /* AB: NEW */ const ASTNodeProperty ASTNodeProperties::declarationSpecifiersProperty( "declaration-specifiers-property" ); } // namespace Refactoring |
From: <net...@us...> - 2003-04-26 10:47:04
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv19224/include/rfta/parser Modified Files: ASTNodes.h Log Message: -- additional nodes/properties for declaration parsing Index: ASTNodes.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/ASTNodes.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ASTNodes.h 15 Apr 2003 19:05:20 -0000 1.16 --- ASTNodes.h 26 Apr 2003 10:46:59 -0000 1.17 *************** *** 54,57 **** --- 54,68 ---- static const ASTNodeType functionImplementation; + // declaration level: + // ////////////////// + static const ASTNodeType declaration; + static const ASTNodeType declarationSpecifierList; + static const ASTNodeType simpleTypeSpecifier; + static const ASTNodeType classSpecifier; + static const ASTNodeType enumSpecifier; + static const ASTNodeType elaboratedTypeSpecifier; + + static const ASTNodeType unparsedDeclarator; + // statement types // /////////////// *************** *** 212,216 **** static const ASTNodeProperty functionBodyProperty; static const ASTNodeProperty functionHeaderProperty; ! }; --- 223,228 ---- static const ASTNodeProperty functionBodyProperty; static const ASTNodeProperty functionHeaderProperty; ! ! static const ASTNodeProperty declarationSpecifiersProperty; }; |
From: <bl...@us...> - 2003-04-26 09:49:29
|
Update of /cvsroot/cpptool/rfta/deplib/boost-compatibility In directory sc8-pr-cvs1:/tmp/cvs-serv1601/boost-compatibility Log Message: Directory /cvsroot/cpptool/rfta/deplib/boost-compatibility added to the repository |
From: <bl...@us...> - 2003-04-25 08:19:36
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv4199/src/rftaparser Modified Files: ForStatementParserTest.cpp ForStatementParserTest.h Log Message: * added test for parser bug: for ( int a, b;; ) Index: ForStatementParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ForStatementParserTest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ForStatementParserTest.cpp 18 Mar 2003 08:11:55 -0000 1.2 --- ForStatementParserTest.cpp 25 Apr 2003 08:19:31 -0000 1.3 *************** *** 101,104 **** --- 101,105 ---- } + void ForStatementParserTest::testDeclaringFor() *************** *** 109,113 **** checkFor ( decl, cond, next ); ! }; void --- 110,123 ---- checkFor ( decl, cond, next ); ! } ! ! ! void ! ForStatementParserTest::testForMultipleDeclarations() ! { ! std::string decl( "int a, b" ); ! checkFor( decl, "", "" ); ! } ! void Index: ForStatementParserTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ForStatementParserTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ForStatementParserTest.h 18 Mar 2003 08:11:55 -0000 1.2 --- ForStatementParserTest.h 25 Apr 2003 08:19:32 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- CPPUNIT_TEST( testForNoArgs ); CPPUNIT_TEST( testDeclaringFor ); + // CPPUNIT_TEST( testForMultipleDeclarations ); CPPUNIT_TEST_SUITE_END(); *************** *** 37,40 **** --- 38,42 ---- void testForNoArgs(); void testDeclaringFor(); + void testForMultipleDeclarations(); private: |
From: <bl...@us...> - 2003-04-25 08:19:35
|
Update of /cvsroot/cpptool/rfta/bin In directory sc8-pr-cvs1:/tmp/cvs-serv4199/bin Modified Files: test.bat Added Files: ForDeclaration.cpp Log Message: * added test for parser bug: for ( int a, b;; ) --- NEW FILE: ForDeclaration.cpp --- { for ( int a, b;; ) //int a, b;; ) ; } Index: test.bat =================================================================== RCS file: /cvsroot/cpptool/rfta/bin/test.bat,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test.bat 12 Mar 2003 07:46:08 -0000 1.6 --- test.bat 25 Apr 2003 08:19:29 -0000 1.7 *************** *** 13,14 **** --- 13,16 ---- astdump 89 108 HTMLWriter.cpp ast astdump 0 15 DeclarativeCondition.cpp ast + astdump 0 4 ForDeclaration.cpp ast + |
From: <bl...@us...> - 2003-04-25 07:53:29
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv26267/src/rfta Modified Files: SplitDeclarationRefactoringTest.cpp SplitDeclarationRefactoringTest.h Log Message: * added a comment out test for 'for' statement declaration. Index: SplitDeclarationRefactoringTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitDeclarationRefactoringTest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SplitDeclarationRefactoringTest.cpp 24 Apr 2003 16:28:30 -0000 1.2 --- SplitDeclarationRefactoringTest.cpp 25 Apr 2003 07:53:26 -0000 1.3 *************** *** 142,145 **** --- 142,146 ---- } + void SplitDeclarationRefactoringTest::testSubscope() *************** *** 163,167 **** RFTA_ASSERT_EQUAL( expectedSource, actualSource ); ! }; } // namespace Refactoring --- 164,188 ---- RFTA_ASSERT_EQUAL( expectedSource, actualSource ); ! } ! ! ! void ! SplitDeclarationRefactoringTest::testForDeclerations() ! { ! builder_->add( "{\n"); ! builder_->addKeyingMid(" for ( int ", "a", ";;)\n", "selection" ); ! builder_->add( " ;\n"); ! builder_->add( "}\n" ); ! applyRefactoring( ); ! std::string expectedSource( ! "{\n" ! " int a;\n" ! " for (;;)\n" ! " ;\n" ! "}\n"); ! std::string actualSource( document_->getAllText() ); ! RFTA_ASSERT_EQUAL( expectedSource, actualSource ); ! } ! } // namespace Refactoring Index: SplitDeclarationRefactoringTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitDeclarationRefactoringTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SplitDeclarationRefactoringTest.h 24 Apr 2003 16:28:29 -0000 1.2 --- SplitDeclarationRefactoringTest.h 25 Apr 2003 07:53:26 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- CPPUNIT_TEST( testInitializers ); CPPUNIT_TEST( testSubscope ); + // CPPUNIT_TEST( testForDeclerations ); CPPUNIT_TEST_SUITE_END(); *************** *** 44,47 **** --- 45,50 ---- void testInitializers(); void testSubscope(); + void testForDeclerations(); + private: void applyRefactoring( ); |
From: <bl...@us...> - 2003-04-25 07:49:19
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv24666/src/rfta Modified Files: CodeRewriter.cpp Log Message: * changed std::isspace() to a local isSpace() function. Index: CodeRewriter.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** CodeRewriter.cpp 24 Apr 2003 16:28:30 -0000 1.43 --- CodeRewriter.cpp 25 Apr 2003 07:49:15 -0000 1.44 *************** *** 10,14 **** #include <rfta/refactoring/CodeModelExpressions.h> #include <rfta/refactoring/CodeModelStatements.h> ! #include <cctype> namespace Refactoring { namespace CodeModel { --- 10,15 ---- #include <rfta/refactoring/CodeModelExpressions.h> #include <rfta/refactoring/CodeModelStatements.h> ! ! namespace Refactoring { namespace CodeModel { *************** *** 725,756 **** } void CodeRewriter::deleteTextIfNecessary( const Change& change ) { ! if ( change.wasRemoved() || change.wasReplaced() ) ! { replaceText( change.oldRange_, ""); - } } bool ! CodeRewriter::needsToInsertComma( const Change& change, int index, ! bool firstWasAdded) { ! return (index > 0 && change.wasAdded()) || (index == 1 && firstWasAdded); } bool CodeRewriter::needsToInsertSpace( const DeclaratorExpressionPtr& expression ) { ! DeclaratorPtr declarator = expression->getDeclaratorAt(0); ! if (declarator->hasType() && ! declarator->getType()->getTypeText().size() > 0) ! return false; ! std::string type =expression->getPrimaryType()->getTypeText(); ! char lastCharacter = type[type.length()-1]; ! return ! std::isspace( lastCharacter ); - }; } // namespace CodeModel } // namespace Refactoring --- 726,762 ---- } + void CodeRewriter::deleteTextIfNecessary( const Change& change ) { ! if ( change.wasRemoved() || change.wasReplaced() ) replaceText( change.oldRange_, ""); } + bool ! CodeRewriter::needsToInsertComma( const Change& change, ! int index, ! bool firstWasAdded) { ! return (index > 0 && change.wasAdded()) || (index == 1 && firstWasAdded); } + bool CodeRewriter::needsToInsertSpace( const DeclaratorExpressionPtr& expression ) { ! DeclaratorPtr declarator = expression->getDeclaratorAt(0); ! if ( declarator->hasType() && ! declarator->getType()->getTypeText().size() > 0 ) ! return false; ! ! std::string type = expression->getPrimaryType()->getTypeText(); ! char lastCharacter = type[type.length()-1]; ! ! return !isspace( lastCharacter ); ! ! } } // namespace CodeModel } // namespace Refactoring |
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv489/src/rfta Modified Files: SplitDeclarationRefactoringTest.h SplitDeclarationRefactoringTest.cpp CodeWriterTest.h CodeWriterTest.cpp CodeRewriter.h CodeRewriter.cpp Log Message: fixed problem with spaces when rewriting declarator expressions Index: SplitDeclarationRefactoringTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitDeclarationRefactoringTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SplitDeclarationRefactoringTest.h 21 Apr 2003 16:10:21 -0000 1.1 --- SplitDeclarationRefactoringTest.h 24 Apr 2003 16:28:29 -0000 1.2 *************** *** 21,27 **** CPPUNIT_TEST( testEasiestCase ); CPPUNIT_TEST( testSeveralVariables ); ! CPPUNIT_TEST_FAIL( testSpaceProblem ); CPPUNIT_TEST( testSeveralDeclarations ); CPPUNIT_TEST( testInitializers ); CPPUNIT_TEST_SUITE_END(); --- 21,28 ---- CPPUNIT_TEST( testEasiestCase ); CPPUNIT_TEST( testSeveralVariables ); ! CPPUNIT_TEST( testSpaceProblem ); CPPUNIT_TEST( testSeveralDeclarations ); CPPUNIT_TEST( testInitializers ); + CPPUNIT_TEST( testSubscope ); CPPUNIT_TEST_SUITE_END(); *************** *** 42,45 **** --- 43,47 ---- void testSeveralDeclarations(); void testInitializers(); + void testSubscope(); private: void applyRefactoring( ); Index: SplitDeclarationRefactoringTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitDeclarationRefactoringTest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SplitDeclarationRefactoringTest.cpp 21 Apr 2003 16:10:24 -0000 1.1 --- SplitDeclarationRefactoringTest.cpp 24 Apr 2003 16:28:30 -0000 1.2 *************** *** 99,103 **** " double* x;\n" " double y[3];\n" ! " double &z;\n" "}\n" ); std::string actualSource( document_->getAllText() ); --- 99,103 ---- " double* x;\n" " double y[3];\n" ! " double&z;\n" "}\n" ); std::string actualSource( document_->getAllText() ); *************** *** 141,144 **** --- 141,167 ---- RFTA_ASSERT_EQUAL( expectedSource, actualSource ); } + + void + SplitDeclarationRefactoringTest::testSubscope() + { + builder_->add( "{\n" ); + builder_->add( " if (true)\n" ); + builder_->add( " {\n" ); + builder_->addKeyingMid( " int ", "x", ", y;\n", "selection"); + builder_->add( " }\n" ); + builder_->add( "}\n" ); + applyRefactoring( ); + std::string expectedSource( + "{\n" + " if (true)\n" + " {\n" + " int x;\n" + " int y;\n" + " }\n" + "}\n"); + std::string actualSource( document_->getAllText() ); + RFTA_ASSERT_EQUAL( expectedSource, actualSource ); + + }; } // namespace Refactoring Index: CodeWriterTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeWriterTest.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** CodeWriterTest.h 21 Apr 2003 03:08:53 -0000 1.29 --- CodeWriterTest.h 24 Apr 2003 16:28:30 -0000 1.30 *************** *** 46,49 **** --- 46,50 ---- CPPUNIT_TEST( testRemoveDeclaratorMiddle ); CPPUNIT_TEST_FAIL( testRemoveDeclaratorEnd ); + CPPUNIT_TEST( spaceProblem ); CPPUNIT_TEST_SUITE_END(); *************** *** 96,100 **** void testRemoveDeclaratorMiddle(); void testRemoveDeclaratorEnd(); ! private: }; --- 97,101 ---- void testRemoveDeclaratorMiddle(); void testRemoveDeclaratorEnd(); ! void spaceProblem(); private: }; Index: CodeWriterTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeWriterTest.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** CodeWriterTest.cpp 21 Apr 2003 03:08:53 -0000 1.35 --- CodeWriterTest.cpp 24 Apr 2003 16:28:30 -0000 1.36 *************** *** 618,620 **** --- 618,636 ---- "}"); } + + void + CodeWriterTest::spaceProblem() + { + source_ = "{\n" + " int* x, y[3];\n" + "}"; + generateCompound(); + CodeModel::DeclarationStatement &declarationStatement = + dynamic_cast<CodeModel::DeclarationStatement &>( *compound_->getStatementAt(0) ); + declarationStatement.getDeclaration()->removeDeclaratorAt(0); + generateAndCheckSource( "{\n" + " int y[3];\n" + "}"); + } + } // namespace Refactoring Index: CodeRewriter.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** CodeRewriter.h 22 Apr 2003 19:17:02 -0000 1.19 --- CodeRewriter.h 24 Apr 2003 16:28:30 -0000 1.20 *************** *** 168,171 **** --- 168,172 ---- bool needsToInsertComma( const Change& change, int index, bool firstWasAdded); + bool needsToInsertSpace( const DeclaratorExpressionPtr& expression ); private: IndentLevelManager indentManager_; Index: CodeRewriter.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** CodeRewriter.cpp 22 Apr 2003 19:17:01 -0000 1.42 --- CodeRewriter.cpp 24 Apr 2003 16:28:30 -0000 1.43 *************** *** 10,14 **** #include <rfta/refactoring/CodeModelExpressions.h> #include <rfta/refactoring/CodeModelStatements.h> ! namespace Refactoring { namespace CodeModel { --- 10,14 ---- #include <rfta/refactoring/CodeModelExpressions.h> #include <rfta/refactoring/CodeModelStatements.h> ! #include <cctype> namespace Refactoring { namespace CodeModel { *************** *** 636,643 **** if ( isInserting() ) beginInsertNewStatement(); - handleMandatoryChange( expression->getPrimaryTypeChange(), ! *expression->getPrimaryType() ); ! bool firstWasAdded = false; for ( int index = 0; index < expression->getChangeCount(); ++ index ) { --- 636,645 ---- if ( isInserting() ) beginInsertNewStatement(); handleMandatoryChange( expression->getPrimaryTypeChange(), ! *expression->getPrimaryType() ); ! DeclaratorPtr declarator = expression->getDeclaratorAt(0); ! if (needsToInsertSpace( expression ) ) ! insertText( " " ); ! bool firstWasAdded = expression->getChangeAt( 0 ).wasAdded(); for ( int index = 0; index < expression->getChangeCount(); ++ index ) { *************** *** 645,656 **** deleteTextIfNecessary( change ); if (change.wasRemoved()) ! continue; ! if ( index == 0 ) ! firstWasAdded = change.wasAdded(); if ( needsToInsertComma( change, index, firstWasAdded ) ) insertText( ", " ); - DeclaratorPtr declarator = expression->getChangeDeclaratorAt( index ); - ModeModifier mode( mode_, change.isUnmodified() ? updating : inserting ); processDeclarator( declarator ); --- 647,654 ---- deleteTextIfNecessary( change ); if (change.wasRemoved()) ! continue; if ( needsToInsertComma( change, index, firstWasAdded ) ) insertText( ", " ); DeclaratorPtr declarator = expression->getChangeDeclaratorAt( index ); ModeModifier mode( mode_, change.isUnmodified() ? updating : inserting ); processDeclarator( declarator ); *************** *** 743,746 **** --- 741,756 ---- } + bool + CodeRewriter::needsToInsertSpace( const DeclaratorExpressionPtr& expression ) + { + DeclaratorPtr declarator = expression->getDeclaratorAt(0); + if (declarator->hasType() && + declarator->getType()->getTypeText().size() > 0) + return false; + std::string type =expression->getPrimaryType()->getTypeText(); + char lastCharacter = type[type.length()-1]; + return ! std::isspace( lastCharacter ); + + }; } // namespace CodeModel } // namespace Refactoring |
From: <bl...@us...> - 2003-04-22 19:26:12
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv27487/src/rfta Modified Files: rfta.dsp Log Message: * added SplitDeclarationRefactoring * fixed release configuration Index: rfta.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/rfta.dsp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** rfta.dsp 10 Apr 2003 08:37:51 -0000 1.43 --- rfta.dsp 22 Apr 2003 19:25:35 -0000 1.44 *************** *** 255,258 **** --- 255,266 ---- # Begin Source File + SOURCE=.\SplitDeclarationRefactoring.cpp + # End Source File + # Begin Source File + + SOURCE=..\..\include\rfta\refactoring\SplitDeclarationRefactoring.h + # End Source File + # Begin Source File + SOURCE=.\SplitTempRefactoring.cpp # End Source File *************** *** 780,783 **** --- 788,817 ---- # Begin Source File + SOURCE=.\SplitDeclarationRefactoringTest.cpp + + !IF "$(CFG)" == "rfta - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rfta - Win32 Debug" + + !ENDIF + + # End Source File + # Begin Source File + + SOURCE=.\SplitDeclarationRefactoringTest.h + + !IF "$(CFG)" == "rfta - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rfta - Win32 Debug" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=.\SplitTempRefactoringTest.cpp *************** *** 945,948 **** --- 979,991 ---- SOURCE=.\CodeWriterInsertTest.h + + !IF "$(CFG)" == "rfta - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rfta - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File *************** *** 988,991 **** --- 1031,1043 ---- SOURCE=.\CodeWriterTestBase.h + + !IF "$(CFG)" == "rfta - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rfta - Win32 Debug" + + !ENDIF + # End Source File # End Group |
From: <bl...@us...> - 2003-04-22 19:25:45
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv27487/src/rftaparser Modified Files: rftaparser.dsp Log Message: * added SplitDeclarationRefactoring * fixed release configuration Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** rftaparser.dsp 15 Apr 2003 19:06:37 -0000 1.35 --- rftaparser.dsp 22 Apr 2003 19:25:37 -0000 1.36 *************** *** 56,61 **** # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\rftaparser\Release/rftaparser_mdr.ext" /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool ! TargetDir=\Projects\Cpptool\rfta\build\rftaparser\Release ! TargetPath=\Projects\Cpptool\rfta\build\rftaparser\Release\rftaparser_mdr.ext TargetName=rftaparser_mdr SOURCE="$(InputPath)" --- 56,61 ---- # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\rftaparser\Release/rftaparser_mdr.ext" /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool ! TargetDir=\prg\vc\Rfta\build\rftaparser\Release ! TargetPath=\prg\vc\Rfta\build\rftaparser\Release\rftaparser_mdr.ext TargetName=rftaparser_mdr SOURCE="$(InputPath)" *************** *** 90,95 **** # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunitd_dll.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\rftaparser\Debug/rftaparser_mdd.ext" /pdbtype:sept /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool ! TargetDir=\Projects\Cpptool\rfta\build\rftaparser\Debug ! TargetPath=\Projects\Cpptool\rfta\build\rftaparser\Debug\rftaparser_mdd.ext TargetName=rftaparser_mdd SOURCE="$(InputPath)" --- 90,95 ---- # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cppunitd_dll.lib /nologo /dll /debug /machine:I386 /out:"..\..\build\rftaparser\Debug/rftaparser_mdd.ext" /pdbtype:sept /libpath:"../../deplib/cppunit/lib" # Begin Special Build Tool ! TargetDir=\prg\vc\Rfta\build\rftaparser\Debug ! TargetPath=\prg\vc\Rfta\build\rftaparser\Debug\rftaparser_mdd.ext TargetName=rftaparser_mdd SOURCE="$(InputPath)" *************** *** 575,582 **** --- 575,600 ---- SOURCE=.\DeclarationListParserTest.cpp + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File SOURCE=.\DeclarationListParserTest.h + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File *************** *** 609,616 **** --- 627,652 ---- SOURCE=.\DeclarationParserTest.cpp + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File SOURCE=.\DeclarationParserTest.h + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File *************** *** 1046,1053 **** --- 1082,1107 ---- SOURCE=.\UnparsedDeclarationListMutatorTest.cpp + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File SOURCE=.\UnparsedDeclarationListMutatorTest.h + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File |
From: <bl...@us...> - 2003-04-22 19:24:33
|
Update of /cvsroot/cpptool/rfta/bin In directory sc8-pr-cvs1:/tmp/cvs-serv26953/bin Modified Files: install-vc6-addin.bat Log Message: * added comment Index: install-vc6-addin.bat =================================================================== RCS file: /cvsroot/cpptool/rfta/bin/install-vc6-addin.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** install-vc6-addin.bat 18 Dec 2002 18:54:02 -0000 1.1 --- install-vc6-addin.bat 22 Apr 2003 19:24:29 -0000 1.2 *************** *** 1,2 **** --- 1,4 ---- + rem MSDevDir should point to your visual C++ 6 directory (for me c:\wut\prg\vc6\Common\MSDev98). + set ADDINS_DIR=%MSDevDir%\AddIns xcopy /Y rfta_mdr.ext %ADDINS_DIR% |
From: <bl...@us...> - 2003-04-22 19:23:31
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv26443/src/rfta Modified Files: SplitDeclarationRefactoring.cpp Log Message: * changed tabs to spaces * replaced dynamic_cast with dynamic_pointer_cast * refactored a bit Index: SplitDeclarationRefactoring.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitDeclarationRefactoring.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SplitDeclarationRefactoring.cpp 21 Apr 2003 16:10:24 -0000 1.1 --- SplitDeclarationRefactoring.cpp 22 Apr 2003 19:23:27 -0000 1.2 *************** *** 21,30 **** #include <rfta/refactoring/RefactoringError.h> #include <rfta/refactoring/TextDocument.h> - # include <rfta/refactoring/CodeModel.h> - # include <rfta/refactoring/CodeModelStatements.h> - # include <rfta/refactoring/CodeModelForward.h> - # include <rfta/refactoring/CodeModelExpressions.h> - # include <CodeRewriter.h> namespace Refactoring { --- 21,31 ---- #include <rfta/refactoring/RefactoringError.h> #include <rfta/refactoring/TextDocument.h> + #include <rfta/refactoring/CodeModel.h> + #include <rfta/refactoring/CodeModelStatements.h> + #include <rfta/refactoring/CodeModelForward.h> + #include <rfta/refactoring/CodeModelExpressions.h> + #include "CodeRewriter.h" + namespace Refactoring { *************** *** 33,37 **** SplitDeclarationRefactoring:: SplitDeclarationRefactoring( TextDocument &document, ! int declarationLocation ) : RefactoringBase( document ) , declarationLocation_( declarationLocation ) --- 34,38 ---- SplitDeclarationRefactoring:: SplitDeclarationRefactoring( TextDocument &document, ! int declarationLocation ) : RefactoringBase( document ) , declarationLocation_( declarationLocation ) *************** *** 77,105 **** } int SplitDeclarationRefactoring:: findIndexOfCorrectDeclaration( CodeModel::CompoundStatementPtr compound ) { ! int n; ! for (n = 0; n < compound->getStatementCount(); n++) ! { ! CodeModel::StatementPtr statement = compound->getStatementAt(n); ! CodeModel::DeclarationStatement* declaration= ! dynamic_cast<CodeModel::DeclarationStatement*>(&*statement); if (!declaration) ! continue; SourceRange range = declaration->getSourceRange(); ! if (range.getStartIndex() > declarationLocation_) ! continue; ! if (range.getEndIndex() < declarationLocation_ ) ! continue; ! break; ! } ! return n; } CodeModel::StatementPtr ! SplitDeclarationRefactoring:: ! makeDeclarationFromFirstDeclarator ! ( const CodeModel::DeclaratorExpressionPtr declaratorExpression) { CodeModel::DeclaratorPtr firstDeclarator = --- 78,107 ---- } + int SplitDeclarationRefactoring:: findIndexOfCorrectDeclaration( CodeModel::CompoundStatementPtr compound ) { ! int statementIndex = 0; ! for (; statementIndex < compound->getStatementCount(); statementIndex++) ! { ! CodeModel::StatementPtr statement = compound->getStatementAt(statementIndex); ! CodeModel::DeclarationStatementPtr declaration = ! boost::dynamic_pointer_cast<CodeModel::DeclarationStatement>( statement ); if (!declaration) ! continue; ! SourceRange range = declaration->getSourceRange(); ! if ( range.contains( SourceRange( declarationLocation_, 0 ) ) ) ! break; ! } ! ! return statementIndex; } + + CodeModel::StatementPtr ! SplitDeclarationRefactoring::makeDeclarationFromFirstDeclarator( ! const CodeModel::DeclaratorExpressionPtr &declaratorExpression) { CodeModel::DeclaratorPtr firstDeclarator = *************** *** 112,139 **** CodeModel::StatementPtr( new CodeModel::DeclarationStatement( newExpression)); return newStatement; ! }; void SplitDeclarationRefactoring::apply( ) { ! CodeModel::Generator generator; ! CodeModel::CompoundStatementPtr compound = ! generator.generateCompound(sourceNode_->getChildAt(0)); ! int n = findIndexOfCorrectDeclaration( compound ); ! CodeModel::DeclarationStatement* declaration= ! dynamic_cast<CodeModel::DeclarationStatement*> ! (&*compound->getStatementAt(n)); ! CodeModel::DeclaratorExpressionPtr declaratorExpression ! = declaration->getDeclaration(); ! while (declaratorExpression->getDeclaratorCount() > 1) ! { CodeModel::StatementPtr newStatement = ! makeDeclarationFromFirstDeclarator( declaratorExpression ); compound->insertStatementAt( n++, newStatement ); declaratorExpression->removeDeclaratorAt(0); ! } ! std::string source( getDocument().getAllText()); ! CodeModel::CodeRewriter writer(source, 2); ! writer.rewrite(compound, getDocument()); } --- 114,144 ---- CodeModel::StatementPtr( new CodeModel::DeclarationStatement( newExpression)); return newStatement; ! } ! void SplitDeclarationRefactoring::apply( ) { ! CodeModel::Generator generator; ! CodeModel::CompoundStatementPtr compound = ! generator.generateCompound(sourceNode_->getChildAt(0)); ! int n = findIndexOfCorrectDeclaration( compound ); ! ! CodeModel::DeclarationStatement* declaration= ! dynamic_cast<CodeModel::DeclarationStatement*> ! (&*compound->getStatementAt(n)); ! CodeModel::DeclaratorExpressionPtr declaratorExpression ! = declaration->getDeclaration(); ! while (declaratorExpression->getDeclaratorCount() > 1) ! { CodeModel::StatementPtr newStatement = ! makeDeclarationFromFirstDeclarator( declaratorExpression ); compound->insertStatementAt( n++, newStatement ); declaratorExpression->removeDeclaratorAt(0); ! } ! ! std::string source( getDocument().getAllText()); ! CodeModel::CodeRewriter writer(source, 2); ! writer.rewrite(compound, getDocument()); } |
From: <bl...@us...> - 2003-04-22 19:23:30
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv26443/include/rfta/refactoring Modified Files: SplitDeclarationRefactoring.h Log Message: * changed tabs to spaces * replaced dynamic_cast with dynamic_pointer_cast * refactored a bit Index: SplitDeclarationRefactoring.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/SplitDeclarationRefactoring.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SplitDeclarationRefactoring.h 21 Apr 2003 16:10:25 -0000 1.1 --- SplitDeclarationRefactoring.h 22 Apr 2003 19:23:25 -0000 1.2 *************** *** 13,17 **** #include <rfta/refactoring/RefactoringBase.h> ! # include <rfta/refactoring/CodeModelForward.h> namespace Refactoring { --- 13,17 ---- #include <rfta/refactoring/RefactoringBase.h> ! #include <rfta/refactoring/CodeModelForward.h> namespace Refactoring { *************** *** 28,42 **** */ SplitDeclarationRefactoring( TextDocument &document, ! int declarationLocation ); /// Destructor. virtual ~SplitDeclarationRefactoring(); ! void apply( ); private: void prepare(); int findIndexOfCorrectDeclaration( CodeModel::CompoundStatementPtr ); ! CodeModel::StatementPtr makeDeclarationFromFirstDeclarator( const CodeModel::DeclaratorExpressionPtr); private: int declarationLocation_; --- 28,46 ---- */ SplitDeclarationRefactoring( TextDocument &document, ! int declarationLocation ); /// Destructor. virtual ~SplitDeclarationRefactoring(); ! void apply(); private: void prepare(); + int findIndexOfCorrectDeclaration( CodeModel::CompoundStatementPtr ); ! ! CodeModel::StatementPtr makeDeclarationFromFirstDeclarator( ! const CodeModel::DeclaratorExpressionPtr &declaratorExpression); ! private: int declarationLocation_; |
From: <bl...@us...> - 2003-04-22 19:22:31
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv24424/src/rfta Modified Files: IndentLevelManager.h Log Message: * removed include condition Index: IndentLevelManager.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/IndentLevelManager.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** IndentLevelManager.h 21 Apr 2003 03:05:04 -0000 1.11 --- IndentLevelManager.h 22 Apr 2003 19:18:16 -0000 1.12 *************** *** 7,14 **** #include <rfta/refactoring/CodeModelForward.h> #include <string> ! #ifndef _MSC_VER ! # include <deque> ! #endif // _MSC_VER namespace Refactoring { --- 7,13 ---- #include <rfta/refactoring/CodeModelForward.h> + #include <deque> #include <string> ! namespace Refactoring { |
From: <bl...@us...> - 2003-04-22 19:17:06
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv23816/src/rfta Modified Files: CodeModelExpressions.cpp CodeRewriter.cpp CodeRewriter.h Log Message: * changed tabs to spaces * made DeclaratorExpression visitor used a shared_ptr * removed extraneous string includes Index: CodeModelExpressions.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeModelExpressions.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** CodeModelExpressions.cpp 21 Apr 2003 03:08:54 -0000 1.15 --- CodeModelExpressions.cpp 22 Apr 2003 19:17:00 -0000 1.16 *************** *** 168,172 **** DeclaratorExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( *this ); } --- 168,172 ---- DeclaratorExpression::accept( ExpressionVisitor &visitor ) { ! visitor.visit( makeSharedFromThis(this) ); } Index: CodeRewriter.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** CodeRewriter.cpp 21 Apr 2003 16:06:50 -0000 1.41 --- CodeRewriter.cpp 22 Apr 2003 19:17:01 -0000 1.42 *************** *** 632,655 **** void ! CodeRewriter::visit( const DeclaratorExpression &expression ) { if ( isInserting() ) beginInsertNewStatement(); ! ! handleMandatoryChange( expression.getPrimaryTypeChange(), ! *expression.getPrimaryType() ); bool firstWasAdded = false; ! for ( int index = 0; index < expression.getChangeCount(); ++ index ) { ! Change change = expression.getChangeAt( index ); deleteTextIfNecessary( change ); if (change.wasRemoved()) ! continue; if ( index == 0 ) ! firstWasAdded = change.wasAdded(); if ( needsToInsertComma( change, index, firstWasAdded ) ) ! insertText( ", " ); ! DeclaratorPtr declarator = expression.getChangeDeclaratorAt( index ); ModeModifier mode( mode_, change.isUnmodified() ? updating : inserting ); --- 632,655 ---- void ! CodeRewriter::visit( const DeclaratorExpressionPtr &expression ) { if ( isInserting() ) beginInsertNewStatement(); ! ! handleMandatoryChange( expression->getPrimaryTypeChange(), ! *expression->getPrimaryType() ); bool firstWasAdded = false; ! for ( int index = 0; index < expression->getChangeCount(); ++ index ) { ! Change change = expression->getChangeAt( index ); deleteTextIfNecessary( change ); if (change.wasRemoved()) ! continue; if ( index == 0 ) ! firstWasAdded = change.wasAdded(); if ( needsToInsertComma( change, index, firstWasAdded ) ) ! insertText( ", " ); ! DeclaratorPtr declarator = expression->getChangeDeclaratorAt( index ); ModeModifier mode( mode_, change.isUnmodified() ? updating : inserting ); Index: CodeRewriter.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** CodeRewriter.h 21 Apr 2003 03:08:54 -0000 1.18 --- CodeRewriter.h 22 Apr 2003 19:17:02 -0000 1.19 *************** *** 6,20 **** #define RFTA_CODEREWRITER_H #include "TransformList.h" #include <rfta/parser/SourceRange.h> #include <rfta/refactoring/CodeModelVisitor.h> #include <string> - #include "IndentLevelManager.h" - #ifndef _MSC_VER - # include <string> - #endif - namespace Refactoring { --- 6,16 ---- #define RFTA_CODEREWRITER_H + #include "IndentLevelManager.h" #include "TransformList.h" #include <rfta/parser/SourceRange.h> #include <rfta/refactoring/CodeModelVisitor.h> #include <string> namespace Refactoring { *************** *** 59,63 **** void visit( const AssignInitializerExpressionPtr &expression ); void visit( const ConstructorInitializerExpressionPtr &expression ); ! void visit( const DeclaratorExpression &expression ); void visit( const DefaultConditionExpressionPtr &expression ); void visit( const ExpressionPtr &expression ); --- 55,59 ---- void visit( const AssignInitializerExpressionPtr &expression ); void visit( const ConstructorInitializerExpressionPtr &expression ); ! void visit( const DeclaratorExpressionPtr &expression ); void visit( const DefaultConditionExpressionPtr &expression ); void visit( const ExpressionPtr &expression ); |
From: <bl...@us...> - 2003-04-22 19:17:04
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv23816/include/rfta/refactoring Modified Files: CodeModelVisitor.h Log Message: * changed tabs to spaces * made DeclaratorExpression visitor used a shared_ptr * removed extraneous string includes Index: CodeModelVisitor.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelVisitor.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CodeModelVisitor.h 21 Apr 2003 03:08:55 -0000 1.8 --- CodeModelVisitor.h 22 Apr 2003 19:16:59 -0000 1.9 *************** *** 46,50 **** virtual void visit( const AssignInitializerExpressionPtr &expression ) =0; virtual void visit( const ConstructorInitializerExpressionPtr &expression ) =0; ! virtual void visit( const DeclaratorExpression &expression ) =0; virtual void visit( const DefaultConditionExpressionPtr &expression ) =0; virtual void visit( const ExpressionPtr &expression ) =0; --- 46,50 ---- virtual void visit( const AssignInitializerExpressionPtr &expression ) =0; virtual void visit( const ConstructorInitializerExpressionPtr &expression ) =0; ! virtual void visit( const DeclaratorExpressionPtr &expression ) =0; virtual void visit( const DefaultConditionExpressionPtr &expression ) =0; virtual void visit( const ExpressionPtr &expression ) =0; |
From: <bl...@us...> - 2003-04-22 19:13:28
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv21987/include/rfta/refactoring Modified Files: CodeModel.h Log Message: * removed include condition Index: CodeModel.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModel.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CodeModel.h 21 Apr 2003 03:08:55 -0000 1.6 --- CodeModel.h 22 Apr 2003 19:13:20 -0000 1.7 *************** *** 10,18 **** #include <rfta/parser/ASTNodeForward.h> #include <rfta/parser/ASTNodeType.h> #include <stdexcept> - - #ifndef _MSC_VER - # include <map> - #endif namespace Refactoring { namespace CodeModel { --- 10,15 ---- #include <rfta/parser/ASTNodeForward.h> #include <rfta/parser/ASTNodeType.h> + #include <map> #include <stdexcept> namespace Refactoring { namespace CodeModel { |
From: <bl...@us...> - 2003-04-22 19:11:46
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv21323/include/rfta/refactoring Modified Files: ChangeTrackers.h Log Message: * removed extraneous assertion Index: ChangeTrackers.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/ChangeTrackers.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ChangeTrackers.h 21 Apr 2003 03:08:55 -0000 1.2 --- ChangeTrackers.h 22 Apr 2003 19:11:39 -0000 1.3 *************** *** 278,282 **** return it - changes_.begin(); } ! assert(false); // throw std::out_of_range( "index out of range for CompositeChangeTracker::getActualIndex()" ); } --- 278,282 ---- return it - changes_.begin(); } ! throw std::out_of_range( "index out of range for CompositeChangeTracker::getActualIndex()" ); } |
From: <sve...@us...> - 2003-04-21 16:10:32
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring In directory sc8-pr-cvs1:/tmp/cvs-serv20797/include/rfta/refactoring Added Files: SplitDeclarationRefactoring.h Log Message: initial check-in Takes a declaration like int *x, &y, z=5; and splits it into int *x; int &y; int z=5; Implemented using the code model component --- NEW FILE: SplitDeclarationRefactoring.h --- // ////////////////////////////////////////////////////////////////////////// // Header file SplitDeclarationRefactoring.h for class SplitDeclarationRefactoring // (c)Copyright 2002, Sven Reichard. // Created: 2002/12/05 // ////////////////////////////////////////////////////////////////////////// #ifndef RFTA_SPLITDECLARATIONREFACTORING_H #define RFTA_SPLITDECLARATIONREFACTORING_H #include "ToolsBox.h" #include <boost/utility.hpp> #include <rfta/parser/ASTNode.h> #include <rfta/parser/SourceRange.h> #include <rfta/refactoring/RefactoringBase.h> # include <rfta/refactoring/CodeModelForward.h> namespace Refactoring { class SourceRange; class TextDocument; /// SplitDeclaration refactoring. class RFTA_API SplitDeclarationRefactoring : public RefactoringBase { public: /*! Constructs a SplitDeclarationRefactoring object. */ SplitDeclarationRefactoring( TextDocument &document, int declarationLocation ); /// Destructor. virtual ~SplitDeclarationRefactoring(); void apply( ); private: void prepare(); int findIndexOfCorrectDeclaration( CodeModel::CompoundStatementPtr ); CodeModel::StatementPtr makeDeclarationFromFirstDeclarator( const CodeModel::DeclaratorExpressionPtr); private: int declarationLocation_; SourceASTNodePtr sourceNode_; }; // Inlines methods for SplitDeclarationRefactoring: // ------------------------------------------ } // namespace Refactoring #endif // RFTA_SPLITDECLARATIONREFACTORING_H |
From: <sve...@us...> - 2003-04-21 16:10:30
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv20797/src/rfta Added Files: SplitDeclarationRefactoringTest.h SplitDeclarationRefactoringTest.cpp SplitDeclarationRefactoring.cpp Log Message: initial check-in Takes a declaration like int *x, &y, z=5; and splits it into int *x; int &y; int z=5; Implemented using the code model component --- NEW FILE: SplitDeclarationRefactoringTest.h --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2003, Sven Reichard. // Created: 2003/04/18 // ////////////////////////////////////////////////////////////////////////// #ifndef RFTA_SPLITDECLARATIONREFACTORINGTEST_H #define RFTA_SPLITDECLARATIONREFACTORINGTEST_H #include "SourceBasedTestBase.h" namespace Refactoring { class PlainTextDocument; /// Unit tests for SplitDeclarationRefactoringTest class SplitDeclarationRefactoringTest : public SourceBasedTestBase { CPPUNIT_TEST_SUITE( SplitDeclarationRefactoringTest ); CPPUNIT_TEST( testEasiestCase ); CPPUNIT_TEST( testSeveralVariables ); CPPUNIT_TEST_FAIL( testSpaceProblem ); CPPUNIT_TEST( testSeveralDeclarations ); CPPUNIT_TEST( testInitializers ); CPPUNIT_TEST_SUITE_END(); public: /*! Constructs a SplitDeclarationRefactoringTest object. */ SplitDeclarationRefactoringTest(); /// Destructor. virtual ~SplitDeclarationRefactoringTest(); void setUp(); void tearDown(); void testEasiestCase(); void testSeveralVariables(); void testSpaceProblem(); void testSeveralDeclarations(); void testInitializers(); private: void applyRefactoring( ); boost::shared_ptr<PlainTextDocument> document_; }; // Inlines methods for SplitDeclarationRefactoringTest: // ---------------------------------------------- } // namespace Refactoring #endif // RFTA_SPLITDECLARATIONREFACTORINGTEST_H --- NEW FILE: SplitDeclarationRefactoringTest.cpp --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2003, Sven Reichard. // Created: 2003/04/18 // ////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "SplitDeclarationRefactoringTest.h" #include <rfta/refactoring/SplitDeclarationRefactoring.h> #include <rfta/refactoring/PlainTextDocument.h> namespace Refactoring { RFTA_TEST_SUITE_REGISTRATION( SplitDeclarationRefactoringTest ); SplitDeclarationRefactoringTest::SplitDeclarationRefactoringTest() { } SplitDeclarationRefactoringTest::~SplitDeclarationRefactoringTest() { } void SplitDeclarationRefactoringTest::setUp() { SourceBasedTestBase::setUp(); } void SplitDeclarationRefactoringTest::tearDown() { document_.reset(); SourceBasedTestBase::tearDown(); } void SplitDeclarationRefactoringTest::applyRefactoring( ) { document_.reset( new PlainTextDocument( source_ ) ); int selectionIndex = builder_->getStartIndex( "selection" ); SplitDeclarationRefactoring refactoring( *document_, selectionIndex ); refactoring.apply( ); } void SplitDeclarationRefactoringTest::testEasiestCase() { builder_->add("{\n"); builder_->addKeyingMid(" double ", "x", ", y;\n", "selection"); builder_->add("}\n"); applyRefactoring( ); std::string expectedSource( "{\n" " double x;\n" " double y;\n" "}\n" ); std::string actualSource( document_->getAllText() ); RFTA_ASSERT_EQUAL( expectedSource, actualSource ); } void SplitDeclarationRefactoringTest::testSeveralVariables() { builder_->add("{\n"); builder_->addKeyingMid(" double *", "x", ", y[3], &z;\n", "selection"); builder_->add("}\n"); applyRefactoring( ); std::string expectedSource( "{\n" " double *x;\n" " double y[3];\n" " double &z;\n" "}\n" ); std::string actualSource( document_->getAllText() ); RFTA_ASSERT_EQUAL( expectedSource, actualSource ); } void SplitDeclarationRefactoringTest::testSpaceProblem() { builder_->add("{\n"); builder_->addKeyingMid(" double* ", "x", ", y[3], &z;\n", "selection"); builder_->add("}\n"); applyRefactoring( ); std::string expectedSource( "{\n" " double* x;\n" " double y[3];\n" " double &z;\n" "}\n" ); std::string actualSource( document_->getAllText() ); RFTA_ASSERT_EQUAL( expectedSource, actualSource ); } void SplitDeclarationRefactoringTest::testSeveralDeclarations() { builder_->add( "{\n"); builder_->add( " double x, y;\n"); builder_->addKeyingMid(" int ", "a", ", b;\n", "selection" ); builder_->add( " bool n, m;\n"); builder_->add( "}\n" ); applyRefactoring( ); std::string expectedSource( "{\n" " double x, y;\n" " int a;\n" " int b;\n" " bool n, m;\n" "}\n"); std::string actualSource( document_->getAllText() ); RFTA_ASSERT_EQUAL( expectedSource, actualSource ); } void SplitDeclarationRefactoringTest::testInitializers() { builder_->add( "{\n" ); builder_->addKeyingMid( " int x=0, ", "y(2)", ";\n", "selection"); builder_->add( "}\n"); applyRefactoring( ); std::string expectedSource ( "{\n" " int x=0;\n" " int y(2);\n" "}\n"); std::string actualSource( document_->getAllText() ); RFTA_ASSERT_EQUAL( expectedSource, actualSource ); } } // namespace Refactoring --- NEW FILE: SplitDeclarationRefactoring.cpp --- // ////////////////////////////////////////////////////////////////////////// // Implementation file SplitDeclarationRefactoring.cpp for class SplitDeclarationRefactoring // (c)Copyright 2002, Sven Reichard // Created: 2002/12/05 // ////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include <rfta/refactoring/SplitDeclarationRefactoring.h> #include "IdentifierResolver.h" #include "IdentifierResolverContext.h" #include "ReplaceTextTransform.h" #include "TransformList.h" #include <rfta/parser/MaxLODMutator.h> #include <rfta/parser/NonSemanticBlanker.h> #include <rfta/parser/ParseContext.h> #include <rfta/parser/ParserError.h> #include <rfta/parser/ParserTools.h> #include <rfta/parser/SourceASTNode.h> #include <rfta/parser/StatementParser.h> #include <rfta/parser/ASTNodes.h> #include <rfta/refactoring/RefactoringError.h> #include <rfta/refactoring/TextDocument.h> # include <rfta/refactoring/CodeModel.h> # include <rfta/refactoring/CodeModelStatements.h> # include <rfta/refactoring/CodeModelForward.h> # include <rfta/refactoring/CodeModelExpressions.h> # include <CodeRewriter.h> namespace Refactoring { SplitDeclarationRefactoring:: SplitDeclarationRefactoring( TextDocument &document, int declarationLocation ) : RefactoringBase( document ) , declarationLocation_( declarationLocation ) { prepare(); } SplitDeclarationRefactoring::~SplitDeclarationRefactoring() { } void SplitDeclarationRefactoring::prepare() { std::string source( getDocument().getAllText() ); if ( declarationLocation_ >= source.length() ) throw RefactoringError( RefactoringError::selectionNotInSource ); NullPPDirectiveListener nullListener; std::string blankedSource; NonSemanticBlanker blanker( source, blankedSource, nullListener ); blanker.blank(); int compoundStartIndex = ToolsBox::findCompoundBefore( blankedSource, declarationLocation_ ); if ( compoundStartIndex < 0 ) throw RefactoringError( RefactoringError::temporaryNotInFunctionBody ); sourceNode_ = SourceASTNode::create( blankedSource, source ); ParseContext context( sourceNode_ ); StatementParser parser( context, sourceNode_->getBlankedSourceStart() + compoundStartIndex, sourceNode_->getBlankedSourceEnd() ); parser.parse(); // don't bother with lazy parsing for now... MaxLODMutator mutator; mutator.mutate( sourceNode_, sourceNode_ ); } int SplitDeclarationRefactoring:: findIndexOfCorrectDeclaration( CodeModel::CompoundStatementPtr compound ) { int n; for (n = 0; n < compound->getStatementCount(); n++) { CodeModel::StatementPtr statement = compound->getStatementAt(n); CodeModel::DeclarationStatement* declaration= dynamic_cast<CodeModel::DeclarationStatement*>(&*statement); if (!declaration) continue; SourceRange range = declaration->getSourceRange(); if (range.getStartIndex() > declarationLocation_) continue; if (range.getEndIndex() < declarationLocation_ ) continue; break; } return n; } CodeModel::StatementPtr SplitDeclarationRefactoring:: makeDeclarationFromFirstDeclarator ( const CodeModel::DeclaratorExpressionPtr declaratorExpression) { CodeModel::DeclaratorPtr firstDeclarator = declaratorExpression->getDeclaratorAt(0); CodeModel::TypePartPtr type = declaratorExpression->getPrimaryType(); CodeModel::DeclaratorExpressionPtr newExpression = CodeModel::DeclaratorExpressionPtr(new CodeModel::DeclaratorExpression(type)); newExpression->appendDeclarator( firstDeclarator ); CodeModel::StatementPtr newStatement = CodeModel::StatementPtr( new CodeModel::DeclarationStatement( newExpression)); return newStatement; }; void SplitDeclarationRefactoring::apply( ) { CodeModel::Generator generator; CodeModel::CompoundStatementPtr compound = generator.generateCompound(sourceNode_->getChildAt(0)); int n = findIndexOfCorrectDeclaration( compound ); CodeModel::DeclarationStatement* declaration= dynamic_cast<CodeModel::DeclarationStatement*> (&*compound->getStatementAt(n)); CodeModel::DeclaratorExpressionPtr declaratorExpression = declaration->getDeclaration(); while (declaratorExpression->getDeclaratorCount() > 1) { CodeModel::StatementPtr newStatement = makeDeclarationFromFirstDeclarator( declaratorExpression ); compound->insertStatementAt( n++, newStatement ); declaratorExpression->removeDeclaratorAt(0); } std::string source( getDocument().getAllText()); CodeModel::CodeRewriter writer(source, 2); writer.rewrite(compound, getDocument()); } } // namespace Refactoring |