Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv9906/src/rftaparser
Modified Files:
UnparsedDeclarationMutatorTest.cpp
Log Message:
-- code cleanup
Index: UnparsedDeclarationMutatorTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** UnparsedDeclarationMutatorTest.cpp 28 Apr 2003 02:52:50 -0000 1.3
--- UnparsedDeclarationMutatorTest.cpp 28 Apr 2003 11:05:05 -0000 1.4
***************
*** 23,26 ****
--- 23,27 ----
const std::string SPECIFIER = "SPECIFIER";
const std::string DECLARATOR = "DECLARATOR";
+ const std::string SPECIFIERLIST = "SPECIFIERLIST";
namespace Testing
***************
*** 77,88 ****
if (specifierCount>0)
checkASTNodePropertyHas( node,
ASTNodeProperties::declarationSpecifiersProperty,
ASTNodeTypes::declarationSpecifierList,
! specifierStart[0],
! specifierLen[specifierCount-1]+specifierStart[specifierCount-1]-specifierStart[0],
sourceLine,
"SpecifierList=> ASTNodeProperties::declarationSpecifiersProperty"
);
ASTNodePtr specifierList = node->getProperty(ASTNodeProperties::declarationSpecifiersProperty);
--- 78,103 ----
if (specifierCount>0)
+ {
+ int spec_list_index;
+ int spec_list_len;
+ try {
+ spec_list_index = source.getKeyedIndex(SPECIFIERLIST,0);
+ spec_list_len = source.getKeyedLen(SPECIFIERLIST,0);
+ }
+ catch (std::logic_error e)
+ {
+ spec_list_index = specifierStart[0];
+ spec_list_len = specifierStart[specifierStart.size()-1] + specifierLen[specifierLen.size()-1] - specifierStart[0];
+ }
+
checkASTNodePropertyHas( node,
ASTNodeProperties::declarationSpecifiersProperty,
ASTNodeTypes::declarationSpecifierList,
! spec_list_index,
! spec_list_len,
sourceLine,
"SpecifierList=> ASTNodeProperties::declarationSpecifiersProperty"
);
+ }
ASTNodePtr specifierList = node->getProperty(ASTNodeProperties::declarationSpecifiersProperty);
***************
*** 151,169 ****
}
- template<typename T> std::vector<T>& operator<< (std::vector<T>& list, T val)
- {
- list.push_back(val);
- return list;
- }
-
- template std::vector<int>& operator<<(std::vector<int>&, int);
-
void
UnparsedDeclarationMutatorTest::testSimpleDeclaration()
{
Testing::KeyedString source;
source.addKeyed(SPECIFIER , "const" ) << " ";
source.addKeyed(SPECIFIER , "short" ) << " ";
! source.addKeyed(SPECIFIER , "int" ) << " ";
source.addKeyed(DECLARATOR, "std::x" ) << ";";
--- 166,177 ----
}
void
UnparsedDeclarationMutatorTest::testSimpleDeclaration()
{
Testing::KeyedString source;
+ source.setKeyStart(SPECIFIERLIST);
source.addKeyed(SPECIFIER , "const" ) << " ";
source.addKeyed(SPECIFIER , "short" ) << " ";
! source.addKeyed(SPECIFIER , "int" ).setKeyEnd(SPECIFIERLIST) << " ";
source.addKeyed(DECLARATOR, "std::x" ) << ";";
|