mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-15 08:06:19 +00:00
Program: Remove deprecated global variable methods
Fixup all usages Bug: tint:390 Change-Id: I2e239dfc77872acb9f0b2ee5494350605dd780a1 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38545 Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
@@ -1091,7 +1091,7 @@ bool ParserImpl::EmitScalarSpecConstants() {
|
||||
MakeVariable(inst.result_id(), ast::StorageClass::kNone, ast_type,
|
||||
true, ast_expr, std::move(spec_id_decos));
|
||||
if (ast_var) {
|
||||
program_.AddGlobalVariable(ast_var);
|
||||
program_.AST().AddGlobalVariable(ast_var);
|
||||
scalar_spec_constants_.insert(inst.result_id());
|
||||
}
|
||||
}
|
||||
@@ -1209,7 +1209,7 @@ bool ParserImpl::EmitModuleScopeVariables() {
|
||||
ast_constructor, ast::VariableDecorationList{});
|
||||
// TODO(dneto): initializers (a.k.a. constructor expression)
|
||||
if (ast_var) {
|
||||
program_.AddGlobalVariable(ast_var);
|
||||
program_.AST().AddGlobalVariable(ast_var);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1226,7 +1226,7 @@ bool ParserImpl::EmitModuleScopeVariables() {
|
||||
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kPosition),
|
||||
});
|
||||
|
||||
program_.AddGlobalVariable(var);
|
||||
program_.AST().AddGlobalVariable(var);
|
||||
}
|
||||
return success_;
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ Expect<bool> ParserImpl::expect_global_decl() {
|
||||
if (!expect("variable declaration", Token::Type::kSemicolon))
|
||||
return Failure::kErrored;
|
||||
|
||||
program_.AddGlobalVariable(gv.value);
|
||||
program_.AST().AddGlobalVariable(gv.value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ Expect<bool> ParserImpl::expect_global_decl() {
|
||||
if (!expect("constant declaration", Token::Type::kSemicolon))
|
||||
return Failure::kErrored;
|
||||
|
||||
program_.AddGlobalVariable(gc.value);
|
||||
program_.AST().AddGlobalVariable(gc.value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ TEST_F(ParserImplTest, GlobalDecl_GlobalVariable) {
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
|
||||
auto& m = p->get_program();
|
||||
ASSERT_EQ(m.global_variables().size(), 1u);
|
||||
ASSERT_EQ(m.AST().GlobalVariables().size(), 1u);
|
||||
|
||||
auto* v = m.global_variables()[0];
|
||||
auto* v = m.AST().GlobalVariables()[0];
|
||||
EXPECT_EQ(v->symbol(), p->get_program().RegisterSymbol("a"));
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ TEST_F(ParserImplTest, GlobalDecl_GlobalConstant) {
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
|
||||
auto& m = p->get_program();
|
||||
ASSERT_EQ(m.global_variables().size(), 1u);
|
||||
ASSERT_EQ(m.AST().GlobalVariables().size(), 1u);
|
||||
|
||||
auto* v = m.global_variables()[0];
|
||||
auto* v = m.AST().GlobalVariables()[0];
|
||||
EXPECT_EQ(v->symbol(), p->get_program().RegisterSymbol("a"));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ fn main() -> void {
|
||||
|
||||
auto& m = p->get_program();
|
||||
ASSERT_EQ(1u, m.Functions().size());
|
||||
ASSERT_EQ(1u, m.global_variables().size());
|
||||
ASSERT_EQ(1u, m.AST().GlobalVariables().size());
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, HandlesError) {
|
||||
|
||||
@@ -43,7 +43,7 @@ fn main() -> void {
|
||||
|
||||
auto m = p.program();
|
||||
ASSERT_EQ(1u, m.Functions().size());
|
||||
ASSERT_EQ(1u, m.global_variables().size());
|
||||
ASSERT_EQ(1u, m.AST().GlobalVariables().size());
|
||||
}
|
||||
|
||||
TEST_F(ParserTest, HandlesError) {
|
||||
|
||||
Reference in New Issue
Block a user