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

Commit 89287f7

Browse files
committed
reduce debug traces
1 parent fb28c97 commit 89287f7

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

source/workspaced/com/snippets/generator.d

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module workspaced.com.snippets.generator;
22

3+
// debug = TraceGenerator;
4+
35
import dparse.ast;
46
import dparse.lexer;
57

@@ -297,7 +299,7 @@ class SnippetInfoGenerator : ASTVisitor
297299

298300
foreach (t; dec.declarators)
299301
{
300-
trace("push variable ", variableStack.length, " ", t.name.text, " of type ",
302+
debug(TraceGenerator) trace("push variable ", variableStack.length, " ", t.name.text, " of type ",
301303
astToString(dec.type), " and value ", astToString(t.initializer));
302304
variableStack.assumeSafeAppend ~= VariableUsage(dec.type, t.name,
303305
t.initializer ? t.initializer.nonVoidInitializer : null);
@@ -306,7 +308,7 @@ class SnippetInfoGenerator : ASTVisitor
306308
if (dec.autoDeclaration)
307309
foreach (t; dec.autoDeclaration.parts)
308310
{
309-
trace("push variable ", variableStack.length, " ", t.identifier.text,
311+
debug(TraceGenerator) trace("push variable ", variableStack.length, " ", t.identifier.text,
310312
" of type auto and value ", astToString(t.initializer));
311313
variableStack.assumeSafeAppend ~= VariableUsage(dec.type, t.identifier,
312314
t.initializer ? t.initializer.nonVoidInitializer : null);
@@ -322,15 +324,15 @@ class SnippetInfoGenerator : ASTVisitor
322324
{
323325
if (done)
324326
return;
325-
trace("push ", level, " on ", typeid(node).name, " ", current, " -> ", node.tokens[0].index);
327+
debug(TraceGenerator) trace("push ", level, " on ", typeid(node).name, " ", current, " -> ", node.tokens[0].index);
326328

327329
if (node.tokens.length)
328330
{
329331
current = node.tokens[0].index;
330332
if (current >= position)
331333
{
332334
done = true;
333-
trace("done");
335+
debug(TraceGenerator) trace("done");
334336
return;
335337
}
336338
}
@@ -341,7 +343,7 @@ class SnippetInfoGenerator : ASTVisitor
341343
{
342344
if (done)
343345
return;
344-
trace("pop from ", typeid(node).name, " ", current, " -> ",
346+
debug(TraceGenerator) trace("pop from ", typeid(node).name, " ", current, " -> ",
345347
node.tokens[$ - 1].index + node.tokens[$ - 1].tokenText.length);
346348

347349
if (node.tokens.length)
@@ -350,7 +352,7 @@ class SnippetInfoGenerator : ASTVisitor
350352
if (current > position)
351353
{
352354
done = true;
353-
trace("done");
355+
debug(TraceGenerator) trace("done");
354356
return;
355357
}
356358
}

source/workspaced/com/snippets/package.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class SnippetsComponent : ComponentWrapper
146146
RollbackAllocator rba;
147147
scope parsed = parseModule(tokens, cast(string) file, &rba);
148148

149-
trace("determineSnippetInfo at ", position);
149+
//trace("determineSnippetInfo at ", position);
150150

151151
scope gen = new SnippetInfoGenerator(position);
152152
gen.variableStack.reserve(64);

0 commit comments

Comments
 (0)