Skip to content

Commit b66a568

Browse files
committed
work
1 parent 8d774f4 commit b66a568

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/tools/fuzzing/fuzzing.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,10 +1771,21 @@ void TranslateToFuzzReader::mutate(Function* func) {
17711771
void noteNonFlowSubtype(Expression* sub, Type super) {
17721772
noteSubtype(sub, super);
17731773
}
1774-
// TODO: casts, use top
1774+
1775+
// Casts always accept the top type.
17751776
void noteCast(HeapType src, HeapType dst) {}
1776-
void noteCast(Expression* src, Type dst) {}
1777-
void noteCast(Expression* src, Expression* dst) {}
1777+
void noteCast(Expression* src, Type dst) {
1778+
if (!src || !dst.isRef()) {
1779+
return;
1780+
}
1781+
childTypes[src] = dst.with(dst.getHeapType().getTop()).with(Nullable);
1782+
}
1783+
void noteCast(Expression* src, Expression* dst) {
1784+
if (!dst) {
1785+
return;
1786+
}
1787+
noteCast(src, dst->type);
1788+
}
17781789
} finder;
17791790
finder.walkFunctionInModule(func, &wasm);
17801791

0 commit comments

Comments
 (0)