mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 11:41:06 +01:00
Explorer: Remove PrintDepth and implement PrintIndent. (#3113)
This PR removes `PrintDepth` from statement and declaration. Implements `PrintIndent` for better indented formatting along with various changes to make printing of statements and declarations better. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
05e061fe96
commit
289d05813e
@@ -28,12 +28,16 @@ auto AnalyzeProgram(Nonnull<Arena*> arena, AST ast,
|
||||
|
||||
if (trace_stream->is_enabled()) {
|
||||
trace_stream->Heading("source program");
|
||||
llvm::ListSeparator sep("\n\n");
|
||||
for (auto& declaration : ast.declarations) {
|
||||
set_file_ctx.update_source_loc(declaration->source_loc());
|
||||
if (trace_stream->is_enabled()) {
|
||||
*trace_stream << *declaration;
|
||||
*trace_stream << sep << *declaration;
|
||||
}
|
||||
}
|
||||
if (trace_stream->is_enabled()) {
|
||||
*trace_stream << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
SourceLocation source_loc("<Main()>", 0, FileKind::Main);
|
||||
@@ -71,12 +75,16 @@ auto AnalyzeProgram(Nonnull<Arena*> arena, AST ast,
|
||||
set_prog_phase.update_phase(ProgramPhase::Declarations);
|
||||
if (trace_stream->is_enabled()) {
|
||||
trace_stream->Heading("printing declarations");
|
||||
llvm::ListSeparator sep("\n\n");
|
||||
for (auto& declaration : ast.declarations) {
|
||||
set_file_ctx.update_source_loc(declaration->source_loc());
|
||||
if (trace_stream->is_enabled()) {
|
||||
*trace_stream << *declaration;
|
||||
*trace_stream << sep << *declaration;
|
||||
}
|
||||
}
|
||||
if (trace_stream->is_enabled()) {
|
||||
*trace_stream << "\n";
|
||||
}
|
||||
}
|
||||
return ast;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user