mirror of https://gitlab.com/basile.b/dexed.git
nothing
This commit is contained in:
parent
2f0743449d
commit
0483b40ca9
|
@ -10,18 +10,15 @@ import
|
||||||
import
|
import
|
||||||
common;
|
common;
|
||||||
|
|
||||||
private __gshared bool deep = void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes the symbols in the standard output
|
* Serializes the symbols in the standard output
|
||||||
*/
|
*/
|
||||||
void listSymbols(const(Module) mod, AstErrors errors, bool deep = true)
|
void listSymbols(const(Module) mod, AstErrors errors, bool deep = true)
|
||||||
{
|
{
|
||||||
mixin(logCall);
|
mixin(logCall);
|
||||||
symlist.deep = deep;
|
|
||||||
alias SL = SymbolListBuilder!(ListFmt.Pas);
|
alias SL = SymbolListBuilder!(ListFmt.Pas);
|
||||||
SL.addAstErrors(errors);
|
SL.addAstErrors(errors);
|
||||||
SL sl = construct!(SL);
|
SL sl = construct!(SL)(deep);
|
||||||
sl.visit(mod);
|
sl.visit(mod);
|
||||||
sl.serialize.writeln;
|
sl.serialize.writeln;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +62,8 @@ mixin(makeSymbolTypeArray);
|
||||||
|
|
||||||
class SymbolListBuilder(ListFmt Fmt): ASTVisitor
|
class SymbolListBuilder(ListFmt Fmt): ASTVisitor
|
||||||
{
|
{
|
||||||
|
private immutable bool _deep;
|
||||||
|
|
||||||
static if (Fmt == ListFmt.Pas)
|
static if (Fmt == ListFmt.Pas)
|
||||||
{
|
{
|
||||||
static Appender!string pasStream;
|
static Appender!string pasStream;
|
||||||
|
@ -77,6 +76,11 @@ class SymbolListBuilder(ListFmt Fmt): ASTVisitor
|
||||||
|
|
||||||
static uint utc;
|
static uint utc;
|
||||||
|
|
||||||
|
this(bool deep)
|
||||||
|
{
|
||||||
|
_deep = deep;
|
||||||
|
}
|
||||||
|
|
||||||
alias visit = ASTVisitor.visit;
|
alias visit = ASTVisitor.visit;
|
||||||
|
|
||||||
static this()
|
static this()
|
||||||
|
@ -149,7 +153,7 @@ class SymbolListBuilder(ListFmt Fmt): ASTVisitor
|
||||||
pasStream.put(format("col=%d\r", dt.name.column));
|
pasStream.put(format("col=%d\r", dt.name.column));
|
||||||
pasStream.put(format("name='%s'\r", dt.name.text));
|
pasStream.put(format("name='%s'\r", dt.name.text));
|
||||||
pasStream.put("symType=" ~ symbolTypeStrings[st] ~ "\r");
|
pasStream.put("symType=" ~ symbolTypeStrings[st] ~ "\r");
|
||||||
static if (dig) if (deep)
|
static if (dig) if (_deep)
|
||||||
{
|
{
|
||||||
pasStream.put("subs = <");
|
pasStream.put("subs = <");
|
||||||
dt.accept(this);
|
dt.accept(this);
|
||||||
|
@ -164,7 +168,7 @@ class SymbolListBuilder(ListFmt Fmt): ASTVisitor
|
||||||
item["col"] = JSONValue(dt.name.column);
|
item["col"] = JSONValue(dt.name.column);
|
||||||
item["name"] = JSONValue(dt.name.text);
|
item["name"] = JSONValue(dt.name.text);
|
||||||
item["type"] = JSONValue(symbolTypeStrings[st]);
|
item["type"] = JSONValue(symbolTypeStrings[st]);
|
||||||
static if (dig) if (deep)
|
static if (dig) if (_deep)
|
||||||
{
|
{
|
||||||
JSONValue subs = parseJSON("[]");
|
JSONValue subs = parseJSON("[]");
|
||||||
const JSONValue* old = jarray;
|
const JSONValue* old = jarray;
|
||||||
|
|
Loading…
Reference in New Issue