mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +00:00
Rename TypeDeterminer to Resolver
Move out of the src root and into its own subdirectory Rename methods to remove the 'Determine' prefix. Fixed: tint:529 Change-Id: Idf89d647780f8a2e7495c1c9e6c402e00ad45b7c Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44041 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
fd31bbd3f1
commit
5f0ea11365
@@ -27,7 +27,6 @@
|
||||
#include "src/type/f32_type.h"
|
||||
#include "src/type/i32_type.h"
|
||||
#include "src/type/u32_type.h"
|
||||
#include "src/type_determiner.h"
|
||||
#include "src/validator/validator_impl.h"
|
||||
#include "src/validator/validator_test_helper.h"
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "src/type/f32_type.h"
|
||||
#include "src/type/i32_type.h"
|
||||
#include "src/type/void_type.h"
|
||||
#include "src/type_determiner.h"
|
||||
#include "src/validator/validator_impl.h"
|
||||
#include "src/validator/validator_test_helper.h"
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
#include "src/type/struct_type.h"
|
||||
#include "src/type/vector_type.h"
|
||||
#include "src/type/void_type.h"
|
||||
#include "src/type_determiner.h"
|
||||
#include "src/validator/validator_impl.h"
|
||||
#include "src/validator/validator_test_helper.h"
|
||||
|
||||
@@ -85,39 +84,6 @@ TEST_F(ValidatorTest, AssignToScalar_Fail) {
|
||||
"reference storage: __i32");
|
||||
}
|
||||
|
||||
TEST_F(ValidatorTest, UsingUndefinedVariable_Fail) {
|
||||
// b = 2;
|
||||
|
||||
SetSource(Source{Source::Location{12, 34}});
|
||||
auto* lhs = Expr("b");
|
||||
auto* rhs = Expr(2);
|
||||
auto* assign = create<ast::AssignmentStatement>(lhs, rhs);
|
||||
WrapInFunction(assign);
|
||||
|
||||
EXPECT_FALSE(td()->Determine());
|
||||
EXPECT_EQ(td()->error(),
|
||||
"12:34 error: v-0006: identifier must be declared before use: b");
|
||||
}
|
||||
|
||||
TEST_F(ValidatorTest, UsingUndefinedVariableInBlockStatement_Fail) {
|
||||
// {
|
||||
// b = 2;
|
||||
// }
|
||||
|
||||
SetSource(Source{Source::Location{12, 34}});
|
||||
auto* lhs = Expr("b");
|
||||
auto* rhs = Expr(2);
|
||||
|
||||
auto* body = create<ast::BlockStatement>(ast::StatementList{
|
||||
create<ast::AssignmentStatement>(lhs, rhs),
|
||||
});
|
||||
WrapInFunction(body);
|
||||
|
||||
EXPECT_FALSE(td()->Determine());
|
||||
EXPECT_EQ(td()->error(),
|
||||
"12:34 error: v-0006: identifier must be declared before use: b");
|
||||
}
|
||||
|
||||
TEST_F(ValidatorTest, AssignCompatibleTypes_Pass) {
|
||||
// var a :i32 = 2;
|
||||
// a = 2
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
|
||||
namespace tint {
|
||||
|
||||
ValidatorTestHelper::ValidatorTestHelper() {
|
||||
td_ = std::make_unique<TypeDeterminer>(this);
|
||||
}
|
||||
ValidatorTestHelper::ValidatorTestHelper() = default;
|
||||
|
||||
ValidatorTestHelper::~ValidatorTestHelper() = default;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "src/program_builder.h"
|
||||
#include "src/semantic/expression.h"
|
||||
#include "src/type/void_type.h"
|
||||
#include "src/type_determiner.h"
|
||||
#include "src/validator/validator_impl.h"
|
||||
|
||||
namespace tint {
|
||||
@@ -56,10 +55,6 @@ class ValidatorTestHelper : public ProgramBuilder {
|
||||
return *val_;
|
||||
}
|
||||
|
||||
/// A handle to type_determiner
|
||||
/// @returns a pointer to the type_determiner object
|
||||
TypeDeterminer* td() const { return td_.get(); }
|
||||
|
||||
/// Inserts a variable into the current scope.
|
||||
/// @param var the variable to register.
|
||||
void RegisterVariable(ast::Variable* var) {
|
||||
@@ -78,7 +73,6 @@ class ValidatorTestHelper : public ProgramBuilder {
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<TypeDeterminer> td_;
|
||||
std::unique_ptr<Program> program_;
|
||||
std::unique_ptr<ValidatorImpl> val_;
|
||||
std::vector<ast::Variable*> vars_for_testing_;
|
||||
|
||||
Reference in New Issue
Block a user