forked from area9innovation/flow9
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.flow
More file actions
35 lines (29 loc) · 870 Bytes
/
Copy pathdebug.flow
File metadata and controls
35 lines (29 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import tools/flowc/fctypeenv;
import tools/flowc/flowc_println;
export {
printIndent(env : FcTypeEnv, m : string) -> void;
printStay(env : FcTypeEnv, m : string) -> void;
printDedent(env : FcTypeEnv, m : string) -> void;
runIndented(env : FcTypeEnv, fn : () -> ?) -> ?;
}
printIndent(env : FcTypeEnv, m : string) -> void {
i = ^(env.local.debugIndentation);
fcPrintln(i + m);
env.local.debugIndentation := i + " ";
}
printStay(env : FcTypeEnv, m : string) -> void {
i = ^(env.local.debugIndentation);
fcPrintln(i + m);
}
printDedent(env : FcTypeEnv, m : string) -> void {
i = strRight(^(env.local.debugIndentation), 2);
fcPrintln(i + m);
env.local.debugIndentation := i;
}
runIndented(env : FcTypeEnv, fn : () -> ?) -> ? {
i = ^(env.local.debugIndentation);
env.local.debugIndentation := i + " ";
r = fn();
env.local.debugIndentation := i;
r;
}