Fix poor dyn_cast usage (#2763)

Note the dest_class case didn't actually check dyn_cast success until after using the pointer. That's the case I noticed first, but also cleaning up a couple other small related things.
This commit is contained in:
Jon Ross-Perkins
2023-04-12 15:56:27 -07:00
committed by GitHub
parent 9245e17d4c
commit 694dd7bf55
3 changed files with 8 additions and 13 deletions
+1 -1
View File
@@ -979,7 +979,7 @@ auto Interpreter::CallFunction(const CallExpression& call,
}
case Value::Kind::FunctionValue:
case Value::Kind::BoundMethodValue: {
const auto* func_val = dyn_cast<FunctionOrMethodValue>(fun);
const auto* func_val = cast<FunctionOrMethodValue>(fun);
const FunctionDeclaration& function = func_val->declaration();
if (!function.body().has_value()) {