allow terrible method hack to decompiler (#623)

This commit is contained in:
water111 2021-06-23 22:42:02 -04:00 committed by GitHub
parent 44f8ff6d25
commit 83c5852465
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -772,11 +772,13 @@ TP_Type LoadVarOp::get_src_type(const TypeState& input,
ro.offset >= 16 && (ro.offset & 3) == 0 && m_size == 4 && m_kind == Kind::UNSIGNED) {
// method get of an unknown type. We assume the most general "object" type.
auto method_id = (ro.offset - 16) / 4;
auto method_info = dts.ts.lookup_method("object", method_id);
if (method_id != GOAL_NEW_METHOD && method_id != GOAL_RELOC_METHOD) {
// this can get us the wrong thing for `new` methods. And maybe relocate?
return TP_Type::make_non_virtual_method(
method_info.type.substitute_for_method_call("object"), TypeSpec("object"), method_id);
if (method_id <= (int)GOAL_MEMUSAGE_METHOD) {
auto method_info = dts.ts.lookup_method("object", method_id);
if (method_id != GOAL_NEW_METHOD && method_id != GOAL_RELOC_METHOD) {
// this can get us the wrong thing for `new` methods. And maybe relocate?
return TP_Type::make_non_virtual_method(
method_info.type.substitute_for_method_call("object"), TypeSpec("object"), method_id);
}
}
}