sem: Add constructor nullptr assertions

Catch the nullptrs early.

Change-Id: Ie8ee30355c79c6cbd589831f6587752b125d45c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49754
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2021-05-05 10:48:22 +00:00 committed by Commit Bot service account
parent a67583cde3
commit bd7e8442b8
2 changed files with 6 additions and 2 deletions

View File

@ -22,7 +22,9 @@ namespace tint {
namespace sem { namespace sem {
CallTarget::CallTarget(sem::Type* return_type, const ParameterList& parameters) CallTarget::CallTarget(sem::Type* return_type, const ParameterList& parameters)
: return_type_(return_type), parameters_(parameters) {} : return_type_(return_type), parameters_(parameters) {
TINT_ASSERT(return_type);
}
CallTarget::~CallTarget() = default; CallTarget::~CallTarget() = default;

View File

@ -24,7 +24,9 @@ Expression::Expression(ast::Expression* declaration,
Statement* statement) Statement* statement)
: declaration_(declaration), : declaration_(declaration),
type_(type->UnwrapIfNeeded()), type_(type->UnwrapIfNeeded()),
statement_(statement) {} statement_(statement) {
TINT_ASSERT(type_);
}
} // namespace sem } // namespace sem
} // namespace tint } // namespace tint