Update after code review.

This commit is contained in:
Joakim Brannstrom 2015-07-17 13:01:16 +02:00
parent 81bc94e873
commit 3025185a55
1 changed files with 14 additions and 15 deletions

View File

@ -19,7 +19,7 @@ import std.typecons;
* Prints CTAGS information to the given file. * Prints CTAGS information to the given file.
* Includes metadata according to exuberant format used by Vim. * Includes metadata according to exuberant format used by Vim.
* Params: * Params:
* outpt = the file that Exuberant TAGS info is written to * output = the file that Exuberant TAGS info is written to
* fileNames = tags will be generated from these files * fileNames = tags will be generated from these files
*/ */
void printCtags(File output, string[] fileNames) void printCtags(File output, string[] fileNames)
@ -49,13 +49,15 @@ void printCtags(File output, string[] fileNames)
private: private:
/// States determining how an access modifier affects the parsning. /// States determining how an access modifier affects tags when traversing the
/// Reset, when ascending the AST reset back to the previous access. /// AST.
/// Keep, when ascending the AST keep the new access. /// The assumption is that there are fewer AST nodes and patterns that affects
/// the whole scope.
/// Therefor the default was chosen to be Reset.
enum AccessState enum AccessState
{ {
Reset, Reset, /// when ascending the AST reset back to the previous access.
Keep Keep /// when ascending the AST keep the new access.
} }
alias ContextType = Tuple!(string, "c", string, "access"); alias ContextType = Tuple!(string, "c", string, "access");
@ -71,7 +73,7 @@ string paramsToString(Dec)(const Dec dec)
auto app = appender!string(); auto app = appender!string();
auto formatter = new Formatter!(typeof(app))(app); auto formatter = new Formatter!(typeof(app))(app);
static if (is(Dec == FunctionDeclaration)) static if (is(Dec == FunctionDeclaration) || is(Dec == Constructor))
{ {
formatter.format(dec.parameters); formatter.format(dec.parameters);
} }
@ -79,10 +81,6 @@ string paramsToString(Dec)(const Dec dec)
{ {
formatter.format(dec.templateParameters); formatter.format(dec.templateParameters);
} }
else static if (is(Dec == Constructor))
{
formatter.format(dec.parameters);
}
return app.data; return app.data;
} }
@ -282,10 +280,11 @@ final class CTagsPrinter
override void visit(const Unittest dec) override void visit(const Unittest dec)
{ {
// skipping symbols inside a unit test. // skipping symbols inside a unit test to not clutter the ctags file
//TODO investigate if it would be useful to show the unittests that was // with "temporary" symbols.
//found when std.experimental.unittest is released. Could be possible // TODO when phobos have a unittest library investigate how that could
//to then use the UDA to show the unittest with a "name". // be used to describe the tests.
// Maybe with UDA's to give the unittest a "name".
} }
override void visit(const AliasDeclaration dec) override void visit(const AliasDeclaration dec)