mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 22:44:04 +00:00
validator: Support assignment through pointer
Also enable a test to check assigning to scalar literal. Fixed: tint:419 Change-Id: Ic565af22c4ef6b60c41faaf9fabe3bd55fe48d2d Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37961 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: David Neto <dneto@google.com> Auto-Submit: David Neto <dneto@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
579f6a0450
commit
71012dcc2f
@@ -100,6 +100,12 @@ class ValidatorImpl {
|
||||
/// @param assign the assignment to check
|
||||
/// @returns true if the validation was successful
|
||||
bool ValidateAssign(const ast::AssignmentStatement* assign);
|
||||
/// Validates a bad assignment to an identifier. Issues an error
|
||||
/// and returns false if the left hand side is an identifier.
|
||||
/// @param assign the assignment to check
|
||||
/// @returns true if the LHS of theassignment is not an identifier expression
|
||||
bool ValidateBadAssignmentToIdentifier(
|
||||
const ast::AssignmentStatement* assign);
|
||||
/// Validates an expression
|
||||
/// @param expr the expression to check
|
||||
/// @return true if the expression is valid
|
||||
@@ -108,14 +114,6 @@ class ValidatorImpl {
|
||||
/// @param ident the identifer to check if its in the scope
|
||||
/// @return true if idnet was defined
|
||||
bool ValidateIdentifier(const ast::IdentifierExpression* ident);
|
||||
/// Validates if the input follows type checking rules
|
||||
/// @param assign the assignment to check
|
||||
/// @returns ture if successful
|
||||
bool ValidateResultTypes(const ast::AssignmentStatement* assign);
|
||||
/// Validate v-0021: Cannot re-assign a constant
|
||||
/// @param assign is the assigment to check if its lhs is a const
|
||||
/// @returns false if lhs of assign is a constant identifier
|
||||
bool ValidateConstant(const ast::AssignmentStatement* assign);
|
||||
/// Validates declaration name uniqueness
|
||||
/// @param decl is the new declaration to be added
|
||||
/// @returns true if no previous declaration with the `decl` 's name
|
||||
@@ -154,6 +152,11 @@ class ValidatorImpl {
|
||||
/// @returns true if the given type is storable.
|
||||
bool IsStorable(ast::type::Type* type);
|
||||
|
||||
/// Testing method to inserting a given variable into the current scope.
|
||||
void RegisterVariableForTesting(ast::Variable* var) {
|
||||
variable_stack_.set(var->symbol(), var);
|
||||
}
|
||||
|
||||
private:
|
||||
const ast::Module& module_;
|
||||
diag::List diags_;
|
||||
|
||||
Reference in New Issue
Block a user