[validation] impl v-0015: runtime array may only appear last

This CL adds checks to verify that runtime arrays only appear as the last element of a struct

Bug: tint:345
Change-Id: Ic2930aaf1e24e5c1d116add3a4a6dbdb9eaa02a7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33261
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This commit is contained in:
Sarah Mashayekhi
2020-11-18 22:34:30 +00:00
committed by Commit Bot service account
parent 3ea3c997b5
commit d8ea65bb2c
3 changed files with 104 additions and 7 deletions

View File

@@ -17,6 +17,7 @@
#include <string>
#include <unordered_map>
#include <vector>
#include "src/ast/assignment_statement.h"
#include "src/ast/call_expression.h"
@@ -118,6 +119,12 @@ class ValidatorImpl {
/// @returns true if the valdiation was successful
bool ValidateEntryPoint(const ast::FunctionList& funcs);
/// Validates constructed types
/// @param constructed_types the types to check
/// @returns true if the valdiation was successful
bool ValidateConstructedTypes(
const std::vector<ast::type::Type*>& constructed_types);
private:
std::string error_;
ScopeStack<ast::Variable*> variable_stack_;