Emit call statements from the various backends.
This CL adds emission of CallStatement to the various backends.
Bug: tint:45
Change-Id: Ia2bdf0433f136c516ecccdcbc64a5365094220af
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25281
Reviewed-by: David Neto <dneto@google.com>
diff --git a/src/writer/wgsl/generator_impl.cc b/src/writer/wgsl/generator_impl.cc
index 817da91..4eb9583 100644
--- a/src/writer/wgsl/generator_impl.cc
+++ b/src/writer/wgsl/generator_impl.cc
@@ -26,6 +26,7 @@
#include "src/ast/break_statement.h"
#include "src/ast/builtin_decoration.h"
#include "src/ast/call_expression.h"
+#include "src/ast/call_statement.h"
#include "src/ast/case_statement.h"
#include "src/ast/cast_expression.h"
#include "src/ast/constructor_expression.h"
@@ -631,6 +632,14 @@
if (stmt->IsBreak()) {
return EmitBreak(stmt->AsBreak());
}
+ if (stmt->IsCall()) {
+ make_indent();
+ if (!EmitCall(stmt->AsCall()->expr())) {
+ return false;
+ }
+ out_ << ";" << std::endl;
+ return true;
+ }
if (stmt->IsContinue()) {
return EmitContinue(stmt->AsContinue());
}
@@ -656,7 +665,7 @@
return EmitVariable(stmt->AsVariableDecl()->variable());
}
- error_ = "unknown statement type";
+ error_ = "unknown statement type: " + stmt->str();
return false;
}