@@ -475,7 +475,7 @@ std::string clangimport::AstNode::getTemplateParameters() const
475475void clangimport::AstNode::dumpAst (int num, int indent) const
476476{
477477 (void )num;
478- std::cout << std::string (indent, ' ' ) << mKind ;
478+ std::cout << std::string (indent, ' ' ) << mKind << " " << mJsonObject . at ( " id " ). get <std::string>() << " " << getSpelling () ;
479479 // JSON for (const auto& tok: mExtTokens)
480480 // JSON std::cout << " " << tok;
481481 std::cout << std::endl;
@@ -873,15 +873,15 @@ Token *clangimport::AstNode::createTokens(TokenList &tokenList)
873873 return nullptr ;
874874 }
875875 if (mKind == CXXForRangeStmt) {
876- /* JSON
877876 Token *forToken = addtoken (tokenList, " for" );
878877 Token *par1 = addtoken (tokenList, " (" );
879878 AstNodePtr varDecl;
880- if (children[6]->mKind == DeclStmt)
881- varDecl = getChild(6)->getChild(0);
882- else
883- varDecl = getChild(5)->getChild(0);
884- varDecl->mExtTokens.pop_back();
879+ for (auto it = children.rbegin (); it != children.rend (); ++it) {
880+ if ((*it)->mKind == DeclStmt) {
881+ varDecl = (*it)->getChild (0 );
882+ break ;
883+ }
884+ }
885885 varDecl->children .clear ();
886886 Token *expr1 = varDecl->createTokens (tokenList);
887887 Token *colon = addtoken (tokenList, " :" );
@@ -906,7 +906,7 @@ Token *clangimport::AstNode::createTokens(TokenList &tokenList)
906906 par1->astOperand2 (colon);
907907
908908 createScope (tokenList, Scope::ScopeType::eFor, children.back (), forToken);
909- */
909+
910910 return nullptr ;
911911 }
912912 if (mKind == CXXMethodDecl) {
0 commit comments