Skip to content

Commit baefe3d

Browse files
Flag all shows both context and the debug info
1 parent a684f45 commit baefe3d

4 files changed

Lines changed: 11 additions & 22 deletions

File tree

liquidjava-verifier/src/main/java/liquidjava/api/CommandLineArgs.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public class CommandLineArgs {
2222
@Option(names = { "-d", "--debug" }, description = "Enable debug mode for more detailed output")
2323
public boolean debugMode;
2424

25-
@Option(names = { "-a", "--all-context" }, description = "Print the full context after every checked element")
26-
public boolean printContext;
25+
@Option(names = { "-a", "--all" }, description = "Print the full context plus the debug trace (implies -d)")
26+
public boolean all;
2727

2828
@Option(names = { "-lsp", "--language-server" }, description = "Enable language server mode for editor support")
2929
public boolean lspMode;

liquidjava-verifier/src/main/java/liquidjava/diagnostics/DebugLog.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import java.util.List;
55
import liquidjava.api.CommandLineLauncher;
66
import liquidjava.processor.VCImplication;
7-
import liquidjava.processor.context.Context;
8-
import liquidjava.processor.context.ContextHistory;
97
import liquidjava.rj_language.Predicate;
108
import liquidjava.rj_language.ast.BinaryExpression;
119
import liquidjava.rj_language.ast.Expression;
@@ -38,12 +36,12 @@ private DebugLog() {
3836
}
3937

4038
public static boolean enabled() {
41-
return CommandLineLauncher.cmdArgs.debugMode;
39+
return CommandLineLauncher.cmdArgs.debugMode || CommandLineLauncher.cmdArgs.all;
4240
}
4341

44-
/** Gate for the full-context dump, driven by the {@code -a} / {@code --all-context} flag (independent of debug). */
42+
/** Gate for the full-context dump, driven by the {@code -a} / {@code --all} flag (the verbose tier of debug). */
4543
public static boolean contextEnabled() {
46-
return CommandLineLauncher.cmdArgs.printContext;
44+
return CommandLineLauncher.cmdArgs.all;
4745
}
4846

4947
/**
@@ -473,12 +471,4 @@ public static void contextAtElement(CtElement element, String contextInfo) {
473471
System.out.println(header);
474472
System.out.println(contextInfo);
475473
}
476-
477-
public static void log(String string) {
478-
if (!enabled()) {
479-
return;
480-
}
481-
System.out.println(string);
482-
483-
}
484474
}

liquidjava-verifier/src/main/java/liquidjava/processor/context/ContextHistory.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public void clearHistory() {
4646
}
4747

4848
public void saveContext(CtElement element, Context context) {
49-
if (!CommandLineLauncher.cmdArgs.lspMode && !CommandLineLauncher.cmdArgs.debugMode
50-
&& !CommandLineLauncher.cmdArgs.printContext)
49+
if (!CommandLineLauncher.cmdArgs.lspMode && !CommandLineLauncher.cmdArgs.all)
5150
return;
5251

5352
String file = Utils.getFile(element);
@@ -67,7 +66,7 @@ public void saveContext(CtElement element, Context context) {
6766
aliases.addAll(context.getAliases());
6867
methods.addAll(context.getCtxFunctions());
6968

70-
// Gate lives inside DebugLog.contextAtElement (-a / --all-context); no-op unless that flag is set.
69+
// Gate lives inside DebugLog.contextAtElement (-a / --all); no-op unless that flag is set.
7170
DebugLog.contextAtElement(element, prettyPrint());
7271
}
7372

liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/RefinementTypeChecker.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ public RefinementTypeChecker(Context context, Factory factory) {
7575
// --------------------- Visitors -----------------------------------
7676

7777
/**
78-
* Under {@code -a} / {@code --all-context}, dump the context after every top-level statement. {@code super.scan}
79-
* runs the full {@code visitCtXxx} override first, so the statement's refinement effect is already applied to the
80-
* context by the time we save it. The {@code STATEMENT} role filter keeps this to actual statements (direct block /
81-
* case children), skipping sub-expressions like the {@code g(x)} in {@code f(g(x))}.
78+
* Under {@code -a} / {@code --all}, dump the context after every top-level statement. {@code super.scan} runs the
79+
* full {@code visitCtXxx} override first, so the statement's refinement effect is already applied to the context by
80+
* the time we save it. The {@code STATEMENT} role filter keeps this to actual statements (direct block / case
81+
* children), skipping sub-expressions like the {@code g(x)} in {@code f(g(x))}.
8282
*/
8383
@Override
8484
public void scan(CtElement element) {

0 commit comments

Comments
 (0)