Simplify getting entry point function
The get-by-name method on the function stack already tells us if the name exists. We don't have to check, and then get it later. Change-Id: I26a1d395a9986df48f598055c3bc2864d94c87a8 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28260 Commit-Queue: David Neto <dneto@google.com> Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This commit is contained in:
parent
0ecac8f6ab
commit
b6adc5bd42
|
@ -84,16 +84,14 @@ bool ValidatorImpl::ValidateEntryPoints(const ast::EntryPointList& eps) {
|
||||||
entry_point_map.push_scope();
|
entry_point_map.push_scope();
|
||||||
for (const auto& ep : eps) {
|
for (const auto& ep : eps) {
|
||||||
auto* ep_ptr = ep.get();
|
auto* ep_ptr = ep.get();
|
||||||
if (!function_stack_.has(ep_ptr->function_name())) {
|
ast::Function* func = nullptr;
|
||||||
|
if (!function_stack_.get(ep_ptr->function_name(), &func)) {
|
||||||
set_error(ep_ptr->source(),
|
set_error(ep_ptr->source(),
|
||||||
"v-0019: Function used in entry point does not exist: '" +
|
"v-0019: Function used in entry point does not exist: '" +
|
||||||
ep_ptr->function_name() + "'");
|
ep_ptr->function_name() + "'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::Function* func = nullptr;
|
|
||||||
function_stack_.get(ep_ptr->function_name(), &func);
|
|
||||||
|
|
||||||
if (!func->return_type()->IsVoid()) {
|
if (!func->return_type()->IsVoid()) {
|
||||||
set_error(ep_ptr->source(),
|
set_error(ep_ptr->source(),
|
||||||
"v-0024: Entry point function must return void: '" +
|
"v-0024: Entry point function must return void: '" +
|
||||||
|
|
Loading…
Reference in New Issue