Skip to content

Commit d73bf13

Browse files
feat(cli): default to dump all if no specific dump is requested
1 parent 2bdb5d8 commit d73bf13

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cli/src/main/kotlin/tools/samt/cli/CliDumper.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ internal fun dump(command: DumpCommand, terminal: Terminal, controller: Diagnost
1414
return
1515
}
1616

17+
val dumpAll = !command.dumpTokens && !command.dumpAst && !command.dumpTypes
18+
1719
// attempt to parse each source file into an AST
1820
val fileNodes = buildList {
1921
for (source in sourceFiles) {
2022
val context = controller.createContext(source)
2123

22-
if (command.dumpTokens) {
24+
if (dumpAll || command.dumpTokens) {
2325
// create duplicate scan because sequence can only be iterated once
2426
val tokenStream = Lexer.scan(source.content.reader(), context)
2527
terminal.println("Tokens for ${source.absolutePath}:")
@@ -41,7 +43,7 @@ internal fun dump(command: DumpCommand, terminal: Terminal, controller: Diagnost
4143
continue
4244
}
4345

44-
if (command.dumpAst) {
46+
if (dumpAll || command.dumpAst) {
4547
terminal.println(ASTPrinter.dump(fileNode))
4648
}
4749

@@ -61,7 +63,7 @@ internal fun dump(command: DumpCommand, terminal: Terminal, controller: Diagnost
6163
// build up the semantic model from the AST
6264
SemanticModelBuilder.build(fileNodes, controller)
6365

64-
if (command.dumpTypes) {
66+
if (dumpAll || command.dumpTypes) {
6567
terminal.println("Types:")
6668
terminal.println("Not yet implemented")
6769
// Type dumper will be added here

0 commit comments

Comments
 (0)