[wgsl-writer] Use EmitDecorations() for function parameters

Removes some duplicated code.

Change-Id: I05120e5f443810e54babb842f0f993e4e0a7da79
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44603
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price 2021-03-15 17:35:02 +00:00 committed by Commit Bot service account
parent a089a56c73
commit 6eda12a55d
1 changed files with 4 additions and 8 deletions

View File

@ -309,15 +309,11 @@ bool GeneratorImpl::EmitFunction(ast::Function* func) {
} }
first = false; first = false;
for (auto* deco : v->decorations()) { if (!v->decorations().empty()) {
out_ << "[["; if (!EmitDecorations(v->decorations())) {
if (auto* builtin = deco->As<ast::BuiltinDecoration>()) { return false;
out_ << "builtin(" << builtin->value() << ")";
} }
if (auto* location = deco->As<ast::LocationDecoration>()) { out_ << " ";
out_ << "location(" << location->value() << ")";
}
out_ << "]] ";
} }
out_ << program_->Symbols().NameFor(v->symbol()) << " : "; out_ << program_->Symbols().NameFor(v->symbol()) << " : ";