Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv18860/rfta
Modified Files:
GlobalIdentifierResolver.h GlobalIdentifierResolver.cpp
Log Message:
-- extended global resolver for enumeration type
Index: GlobalIdentifierResolver.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/GlobalIdentifierResolver.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** GlobalIdentifierResolver.h 6 Sep 2003 21:45:57 -0000 1.1
--- GlobalIdentifierResolver.h 24 Sep 2003 20:38:15 -0000 1.2
***************
*** 38,41 ****
--- 38,45 ----
private:
IdentifierResolverStrategy &context_;
+
+ void visitClassSpecifier( const ASTNodePtr &node );
+ void visitEnumSpecifier ( const ASTNodePtr &node );
+
};
Index: GlobalIdentifierResolver.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/GlobalIdentifierResolver.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** GlobalIdentifierResolver.cpp 15 Sep 2003 09:18:23 -0000 1.2
--- GlobalIdentifierResolver.cpp 24 Sep 2003 20:38:15 -0000 1.3
***************
*** 14,41 ****
void
GlobalIdentifierResolver::visitNode( const ASTNodePtr &node )
{
- // actions before visiting properties and childs
if (node->getType() == ASTNodeTypes::classSpecifier)
{
! // add namespace
! if (node->hasProperty(ASTNodeProperties::classNameProperty))
! { // named classes
! ASTNodePtr classIdent = node->getProperty(ASTNodeProperties::classNameProperty);
! ASTNodePtr classBody = node->getProperty(ASTNodeProperties::classBodyProperty);
! // add class definition reference...
! context_.declareIdentifier(classIdent,IdentifierAttributes::ClassIdentifier);
!
! std::string ident = classIdent->getBlankedText();
! context_.enterNamedSubScope(ident);
! ASTNodeAndPropertyVisitor::visitProperty(ASTNodeProperties::classBodyProperty,classBody);
! context_.leaveNamedSubScope();
! } else
! { // unnamed classes:
! context_.enterUnnamedSubScope();
! ASTNodeAndPropertyVisitor::visitNode(node);
! context_.leaveNamedSubScope();
! }
}
else
{
--- 14,68 ----
void
+ GlobalIdentifierResolver::visitClassSpecifier( const ASTNodePtr &node )
+ {
+ // add namespace
+ if (node->hasProperty(ASTNodeProperties::compositeNameProperty))
+ { // named classes
+ ASTNodePtr classIdent = node->getProperty(ASTNodeProperties::compositeNameProperty);
+ ASTNodePtr classBody = node->getProperty(ASTNodeProperties::classBodyProperty);
+ // add class definition reference...
+ context_.declareIdentifier(classIdent,IdentifierAttributes::ClassIdentifier);
+
+ std::string ident = classIdent->getBlankedText();
+ context_.enterNamedSubScope(ident);
+ ASTNodeAndPropertyVisitor::visitProperty(ASTNodeProperties::classBodyProperty,classBody);
+ context_.leaveNamedSubScope();
+ } else
+ { // unnamed classes:
+ context_.enterUnnamedSubScope();
+ ASTNodeAndPropertyVisitor::visitNode(node);
+ context_.leaveNamedSubScope();
+ }
+ }
+
+ void
+ GlobalIdentifierResolver::visitEnumSpecifier( const ASTNodePtr &node )
+ {
+ // check for enumeration name:
+ if (node->hasProperty(ASTNodeProperties::compositeNameProperty))
+ {
+ ASTNodePtr enumIdent = node->getProperty(ASTNodeProperties::compositeNameProperty);
+
+ // add enum definition reference...
+ context_.declareIdentifier(enumIdent,IdentifierAttributes::EnumIdentifier);
+ }
+
+ // visit enumeration body:
+ ASTNodePtr enumBody = node->getProperty(ASTNodeProperties::enumBodyProperty);
+ ASTNodeAndPropertyVisitor::visitNode(enumBody);
+
+ }
+
+ void
GlobalIdentifierResolver::visitNode( const ASTNodePtr &node )
{
if (node->getType() == ASTNodeTypes::classSpecifier)
{
! visitClassSpecifier( node );
}
+ else if (node->getType() == ASTNodeTypes::enumSpecifier)
+ {
+ visitEnumSpecifier( node );
+ }
else
{
|