mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +00:00
[ast] Add ast::Module::AddFunction()
Remove the non-const ast::Module::Functions() getter. Change-Id: I365eece04837ee6bd51147d226c73e04ce5d9bd4 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41300 Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
cd17ea88e3
commit
3eaa450984
@@ -71,11 +71,12 @@ class Module : public Castable<Module, Node> {
|
||||
return constructed_types_;
|
||||
}
|
||||
|
||||
/// @returns the functions declared in the translation unit
|
||||
const FunctionList& Functions() const { return functions_; }
|
||||
/// Add a function to the Builder
|
||||
/// @param func the function to add
|
||||
void AddFunction(ast::Function* func) { functions_.push_back(func); }
|
||||
|
||||
/// @returns the functions declared in the translation unit
|
||||
FunctionList& Functions() { return functions_; }
|
||||
const FunctionList& Functions() const { return functions_; }
|
||||
|
||||
/// @returns true if all required fields in the AST are present.
|
||||
bool IsValid() const override;
|
||||
|
||||
@@ -117,7 +117,7 @@ TEST_F(ModuleTest, IsValid_Function) {
|
||||
}
|
||||
|
||||
TEST_F(ModuleTest, IsValid_Null_Function) {
|
||||
AST().Functions().Add(nullptr);
|
||||
AST().AddFunction(nullptr);
|
||||
Program program(std::move(*this));
|
||||
EXPECT_FALSE(program.AST().IsValid());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user