Support the zero initializer syntax.
This Cl updates the system to allow zero initializers. This allows:
```
var a : vec3<f32> = vec3<f32>();
```
Bug: tint:34
Change-Id: I84d6b431914c4ddf112ed375fae028d912f4a080
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23660
Reviewed-by: David Neto <dneto@google.com>
diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc
index 1886d62..63e426b 100644
--- a/src/reader/wgsl/parser_impl.cc
+++ b/src/reader/wgsl/parser_impl.cc
@@ -1943,7 +1943,7 @@
// primary_expression
// : (IDENT NAMESPACE)* IDENT
-// | type_decl PAREN_LEFT argument_expression_list PAREN_RIGHT
+// | type_decl PAREN_LEFT argument_expression_list* PAREN_RIGHT
// | const_literal
// | paren_rhs_stmt
// | CAST LESS_THAN type_decl GREATER_THAN paren_rhs_stmt
@@ -2043,9 +2043,13 @@
return nullptr;
}
- auto params = argument_expression_list();
- if (has_error())
- return nullptr;
+ t = peek();
+ ast::ExpressionList params;
+ if (!t.IsParenRight() && !t.IsEof()) {
+ params = argument_expression_list();
+ if (has_error())
+ return nullptr;
+ }
t = next();
if (!t.IsParenRight()) {