Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
Validate type of the constant expressions with const instructions
  • Loading branch information
gumb0 committed Jul 22, 2020
1 parent 62aaee7 commit 10b32f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/fizzy/parser_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ inline void drop_operand(
static_cast<int>(operand_stack.size()) < frame.parent_stack_height + 1)
throw validation_error{"stack underflow"};

if (frame.unreachable && static_cast<int>(operand_stack.size()) == frame.parent_stack_height)
if (static_cast<int>(operand_stack.size()) == frame.parent_stack_height)
{
assert(frame.unreachable); // implied from stack underflow check above
return;
}

const auto actual_type = operand_stack.pop();
if (expected_type.has_value() && actual_type != *expected_type)
Expand Down

0 comments on commit 10b32f9

Please sign in to comment.