[Issue 11337] Ddoc ignores methods in static else block

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 13 19:25:22 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=11337

hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh at quickfur.ath.cx

--- Comment #4 from hsteoh at quickfur.ath.cx ---
A related problem is blocks that are version()'d out. I think this represents a
fundamental weakness of ddoc, in that it only sees code that's actually
compiled, not code that's *potentially* compiled.

There is no easy solution either; for example, the source code may contain
version(none) or static if(0) blocks containing non-compilable code; you
probably don't want to generate docs for that!  But you can't just check the
condition for 'none' or '0' because the actual condition may be more complex
than that.

A potential workaround might be some kind of in-source ddoc directive to tell
ddoc to generate docs for blocks that otherwise would not be compiled, say
something like:

------
/// ddoc:force-gen
static if (myCond) {
    /// Ddocs
    auto stuff(...) { ... }
} else {
    /// more ddocs
    auto otherStuff(...) { ... }
}
------

The ddoc generator would recognize the `ddoc:force-gen` directive and generate
docs for both branches of the static if, where otherwise it would only generate
one.

Just throwing the idea out there to see if it sticks.

--


More information about the Digitalmars-d-bugs mailing list