virtual bool visit(ClassSpecifierAST *ast) { Class *klass = ast->symbol; const QByteArray className = id_cast(ast->name); const Identifier *match0_id = control()->identifier("match0"); Symbol *accept0Method = klass->find(match0_id); for (; accept0Method; accept0Method = accept0Method->next()) { if (accept0Method->identifier() != match0_id) continue; if (checkMethod(accept0Method)) break; } if (! accept0Method) return true; classMap.insert(className, ast); *out << "bool " << className.constData() << "::match0(AST *pattern, ASTMatcher *matcher)" << endl << "{" << endl; visitMembers(klass); *out << " return false;" << endl << "}" << endl << endl; return true; }
virtual bool visit(ClassSpecifierAST *ast) { Class *klass = ast->symbol; const QByteArray className = id_cast(ast->name); if (! className.endsWith("AST")) return false; const Identifier *clone_id = control()->identifier("clone"); Symbol *cloneMethod = klass->find(clone_id); for (; cloneMethod; cloneMethod = cloneMethod->next()) { if (cloneMethod->identifier() != clone_id) continue; if (checkMethod(cloneMethod)) break; } if (! cloneMethod) return true; classMap.insert(className, ast); out << "virtual bool visit(" << className.constData() << " *ast)" << endl << "{" << endl; visitMembers(klass); out << " return false;" << endl << "}" << endl << endl; return false; }
virtual bool visit(ClassSpecifierAST *ast) { Class *klass = ast->symbol; const QByteArray className = id_cast(ast->name); const Identifier *visit_id = control()->identifier("accept0"); Symbol *accept0Method = klass->find(visit_id); for (; accept0Method; accept0Method = accept0Method->next()) { if (accept0Method->identifier() != visit_id) continue; if (checkMethod(accept0Method)) break; } if (! accept0Method) return true; classMap.insert(className, ast); *out << "void " << className.constData() << "::accept0(ASTVisitor *visitor)" << endl << "{" << endl << " if (visitor->visit(this)) {" << endl; visitMembers(klass); *out << " }" << endl << " visitor->endVisit(this);" << endl << "}" << endl << endl; return true; }