Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Commit

Permalink
reduce debug traces
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 committed Jun 25, 2021
1 parent fb28c97 commit 89287f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions source/workspaced/com/snippets/generator.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module workspaced.com.snippets.generator;

// debug = TraceGenerator;

import dparse.ast;
import dparse.lexer;

Expand Down Expand Up @@ -297,7 +299,7 @@ class SnippetInfoGenerator : ASTVisitor

foreach (t; dec.declarators)
{
trace("push variable ", variableStack.length, " ", t.name.text, " of type ",
debug(TraceGenerator) trace("push variable ", variableStack.length, " ", t.name.text, " of type ",
astToString(dec.type), " and value ", astToString(t.initializer));
variableStack.assumeSafeAppend ~= VariableUsage(dec.type, t.name,
t.initializer ? t.initializer.nonVoidInitializer : null);
Expand All @@ -306,7 +308,7 @@ class SnippetInfoGenerator : ASTVisitor
if (dec.autoDeclaration)
foreach (t; dec.autoDeclaration.parts)
{
trace("push variable ", variableStack.length, " ", t.identifier.text,
debug(TraceGenerator) trace("push variable ", variableStack.length, " ", t.identifier.text,
" of type auto and value ", astToString(t.initializer));
variableStack.assumeSafeAppend ~= VariableUsage(dec.type, t.identifier,
t.initializer ? t.initializer.nonVoidInitializer : null);
Expand All @@ -322,15 +324,15 @@ class SnippetInfoGenerator : ASTVisitor
{
if (done)
return;
trace("push ", level, " on ", typeid(node).name, " ", current, " -> ", node.tokens[0].index);
debug(TraceGenerator) trace("push ", level, " on ", typeid(node).name, " ", current, " -> ", node.tokens[0].index);

if (node.tokens.length)
{
current = node.tokens[0].index;
if (current >= position)
{
done = true;
trace("done");
debug(TraceGenerator) trace("done");
return;
}
}
Expand All @@ -341,7 +343,7 @@ class SnippetInfoGenerator : ASTVisitor
{
if (done)
return;
trace("pop from ", typeid(node).name, " ", current, " -> ",
debug(TraceGenerator) trace("pop from ", typeid(node).name, " ", current, " -> ",
node.tokens[$ - 1].index + node.tokens[$ - 1].tokenText.length);

if (node.tokens.length)
Expand All @@ -350,7 +352,7 @@ class SnippetInfoGenerator : ASTVisitor
if (current > position)
{
done = true;
trace("done");
debug(TraceGenerator) trace("done");
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/workspaced/com/snippets/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class SnippetsComponent : ComponentWrapper
RollbackAllocator rba;
scope parsed = parseModule(tokens, cast(string) file, &rba);

trace("determineSnippetInfo at ", position);
//trace("determineSnippetInfo at ", position);

scope gen = new SnippetInfoGenerator(position);
gen.variableStack.reserve(64);
Expand Down

0 comments on commit 89287f7

Please sign in to comment.