1
1
module workspaced.com.snippets.generator ;
2
2
3
+ // debug = TraceGenerator;
4
+
3
5
import dparse.ast;
4
6
import dparse.lexer;
5
7
@@ -297,7 +299,7 @@ class SnippetInfoGenerator : ASTVisitor
297
299
298
300
foreach (t; dec.declarators)
299
301
{
300
- trace(" push variable " , variableStack.length, " " , t.name.text, " of type " ,
302
+ debug (TraceGenerator) trace(" push variable " , variableStack.length, " " , t.name.text, " of type " ,
301
303
astToString(dec.type), " and value " , astToString(t.initializer));
302
304
variableStack.assumeSafeAppend ~= VariableUsage(dec.type, t.name,
303
305
t.initializer ? t.initializer.nonVoidInitializer : null );
@@ -306,7 +308,7 @@ class SnippetInfoGenerator : ASTVisitor
306
308
if (dec.autoDeclaration)
307
309
foreach (t; dec.autoDeclaration.parts)
308
310
{
309
- trace(" push variable " , variableStack.length, " " , t.identifier.text,
311
+ debug (TraceGenerator) trace(" push variable " , variableStack.length, " " , t.identifier.text,
310
312
" of type auto and value " , astToString(t.initializer));
311
313
variableStack.assumeSafeAppend ~= VariableUsage(dec.type, t.identifier,
312
314
t.initializer ? t.initializer.nonVoidInitializer : null );
@@ -322,15 +324,15 @@ class SnippetInfoGenerator : ASTVisitor
322
324
{
323
325
if (done)
324
326
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);
326
328
327
329
if (node.tokens.length)
328
330
{
329
331
current = node.tokens[0 ].index;
330
332
if (current >= position)
331
333
{
332
334
done = true ;
333
- trace(" done" );
335
+ debug (TraceGenerator) trace(" done" );
334
336
return ;
335
337
}
336
338
}
@@ -341,7 +343,7 @@ class SnippetInfoGenerator : ASTVisitor
341
343
{
342
344
if (done)
343
345
return ;
344
- trace(" pop from " , typeid (node).name, " " , current, " -> " ,
346
+ debug (TraceGenerator) trace(" pop from " , typeid (node).name, " " , current, " -> " ,
345
347
node.tokens[$ - 1 ].index + node.tokens[$ - 1 ].tokenText.length);
346
348
347
349
if (node.tokens.length)
@@ -350,7 +352,7 @@ class SnippetInfoGenerator : ASTVisitor
350
352
if (current > position)
351
353
{
352
354
done = true ;
353
- trace(" done" );
355
+ debug (TraceGenerator) trace(" done" );
354
356
return ;
355
357
}
356
358
}
0 commit comments