Skip to content

Commit 166bea1

Browse files
committed
[Heavy] Fix casting issues
1 parent 1f8befe commit 166bea1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

heavy/lib/Context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ heavy::Value ContextLocal::get(heavy::ContextLocalLookup const& C) const {
14501450
heavy::Value ContextLocal::get_binding(
14511451
heavy::ContextLocalLookup const& C) const {
14521452
heavy::Value Value = C.LookupTable.lookup(key());
1453-
return dyn_cast<heavy::Binding>(Value);
1453+
return cast<heavy::Binding>(Value);
14541454
}
14551455

14561456

heavy/lib/OpGen.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,8 @@ mlir::Value OpGen::createSequence(SourceLocation Loc, Value Body) {
689689
// in the lexical order that they were defined.
690690
bool OpGen::WalkDefineInits(Value Env,
691691
llvm::SmallPtrSetImpl<String*>& LocalNames) {
692-
Pair* P = cast<Pair>(Env);
692+
Pair* P = dyn_cast<Pair>(Env);
693+
if (!P) return false;
693694
if (isa<EnvFrame>(P->Car)) return false;
694695
if (WalkDefineInits(P->Cdr, LocalNames)) return true;
695696

0 commit comments

Comments
 (0)