Commit c70af847 authored by Roberto Raggi's avatar Roberto Raggi

Added another simple refactoring operation. Comment enum definitions.

parent ed6f6a2a
...@@ -119,6 +119,25 @@ public: ...@@ -119,6 +119,25 @@ public:
} }
protected: protected:
bool isEnumOrTypedefEnum(SpecifierAST *spec) {
if (! spec)
return false;
if (SimpleSpecifierAST *simpleSpec = spec->asSimpleSpecifier()) {
if (tokenKind(simpleSpec->specifier_token) == T_TYPEDEF)
return isEnumOrTypedefEnum(spec->next);
}
return spec->asEnumSpecifier() != 0;
}
virtual bool visit(SimpleDeclarationAST *ast) {
if (isEnumOrTypedefEnum(ast->decl_specifier_seq)) {
//remove(ast->firstToken(), ast->lastToken());
insertTextBefore(ast->firstToken(), "/* #REF# removed ");
insertTextAfter(ast->lastToken() - 1, "*/");
return true;
}
return true;
}
virtual bool visit(AccessDeclarationAST *ast) virtual bool visit(AccessDeclarationAST *ast)
{ {
if (tokenKind(ast->access_specifier_token) == T_PRIVATE) { if (tokenKind(ast->access_specifier_token) == T_PRIVATE) {
...@@ -164,7 +183,11 @@ protected: ...@@ -164,7 +183,11 @@ protected:
if (ast->lbrace_token) if (ast->lbrace_token)
insertTextAfter(ast->lbrace_token, " Q_OBJECT\n"); insertTextAfter(ast->lbrace_token, " Q_OBJECT\n");
return true; for (DeclarationAST *it = ast->member_specifiers; it; it = it->next) {
accept(it);
}
return false;
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment