From: <net...@us...> - 2003-09-15 09:18:28
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv6176/rfta Modified Files: GlobalIdentifierResolver.cpp Log Message: -- fixed node visiting (use node attributes now) Index: GlobalIdentifierResolver.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/GlobalIdentifierResolver.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GlobalIdentifierResolver.cpp 6 Sep 2003 21:45:57 -0000 1.1 --- GlobalIdentifierResolver.cpp 15 Sep 2003 09:18:23 -0000 1.2 *************** *** 18,31 **** // actions before visiting properties and childs if (node->getType() == ASTNodeTypes::classSpecifier) ! { ! // add class definition reference... ! context_.declareClass(node); // add namespace if (node->hasProperty(ASTNodeProperties::classNameProperty)) { // named classes ASTNodePtr classIdent = node->getProperty(ASTNodeProperties::classNameProperty); std::string ident = classIdent->getBlankedText(); context_.enterNamedSubScope(ident); ! ASTNodeAndPropertyVisitor::visitNode(node); context_.leaveNamedSubScope(); } else --- 18,33 ---- // 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 *************** *** 35,39 **** context_.leaveNamedSubScope(); } ! } else { // visit properties and childs: --- 37,42 ---- context_.leaveNamedSubScope(); } ! } ! else { // visit properties and childs: *************** *** 50,54 **** bool GlobalIdentifierResolver::canSkipNode(const ASTNodePtr& node) const ! { return false; } --- 53,57 ---- bool GlobalIdentifierResolver::canSkipNode(const ASTNodePtr& node) const ! { return false; } *************** *** 58,65 **** GlobalIdentifierResolver::needsToVisitProperties(const ASTNodePtr& node ) const { ! if (node->getType() == ASTNodeTypes::compoundStatement) return false; ! ! return true; } --- 61,69 ---- GlobalIdentifierResolver::needsToVisitProperties(const ASTNodePtr& node ) const { ! const ASTNodeType &type = node->getType(); ! if ( type == ASTNodeTypes::compoundStatement ) return false; ! ! return type.hasAllFeatureOf( ASTNodeTypeFeatures::mayHaveLocalScopeIdentifierProperties ); } *************** *** 68,75 **** GlobalIdentifierResolver::needsToVisitChildren(const ASTNodePtr& node ) const { ! if (node->getType() == ASTNodeTypes::compoundStatement) return false; ! return true; } --- 72,82 ---- GlobalIdentifierResolver::needsToVisitChildren(const ASTNodePtr& node ) const { ! const ASTNodeType &type = node->getType(); ! ! if (type == ASTNodeTypes::compoundStatement) return false; ! return type.hasAllFeatureOf( ASTNodeTypeFeatures::mayHaveLocalScopeIdentifierChildren ); ! } *************** *** 92,100 **** return; } ! if (node->getType() == ASTNodeTypes::declarator) { ! // get the identifier node ! ASTNodePtr ident = node->getChildAt(0); ! context_.declareLocalVariable(ident); } } --- 99,115 ---- return; } ! if (node->getType() == ASTNodeTypes::localScopeIdentifier) { ! ASTNodePtr parent = boost::make_shared(node->getParentNode()); ! if ( !parent ) return; ! ASTNodePtr lastChild = parent->getChildAt( parent->getChildCount()-1 ); ! ! // resolving for declarator childs has special behaviour ! if ( parent->getType() != ASTNodeTypes::declarator || ! node == lastChild ) ! { ! context_.declareIdentifier(node, IdentifierAttributes::NoAttribute); ! } else ! context_.resolveUnqualifiedIdentifier( node ); } } |