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:
Ben Clayton
2021-01-26 16:57:10 +00:00
parent a07396a13c
commit a86f4effe4
31 changed files with 252 additions and 256 deletions

View File

@@ -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_;
}

View File

@@ -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;
}

View File

@@ -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"));
}

View File

@@ -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) {

View File

@@ -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) {