Allow AST dumping even if resolution failed
Fixed: tint:674
Change-Id: I1a13a20c5c2c886d04e3d37a198109e62ad7dad2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50246
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/samples/main.cc b/samples/main.cc
index 89567e3..5346d72 100644
--- a/samples/main.cc
+++ b/samples/main.cc
@@ -642,13 +642,14 @@
if (program->Diagnostics().count() > 0) {
diag_formatter.format(program->Diagnostics(), diag_printer.get());
}
- if (!program->IsValid()) {
- return 1;
- }
if (options.dump_ast) {
std::cout << std::endl << program->to_str(options.demangle) << std::endl;
}
+
+ if (!program->IsValid()) {
+ return 1;
+ }
if (options.parse_only) {
return 1;
}