mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
[decomp] make bg decompile (#624)
* make bg decopmile * fix parent method call
This commit is contained in:
parent
d54eb0b98d
commit
9e6dec9829
|
@ -22,7 +22,8 @@ template <typename... Args>
|
|||
fmt::print(fg(fmt::color::yellow), str + '\n', std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
throw std::runtime_error("Type Error");
|
||||
throw std::runtime_error(
|
||||
fmt::format("Type Error: {}", fmt::format(str, std::forward<Args>(args)...)));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -454,7 +454,8 @@ TP_Type SimpleExpression::get_type_int2(const TypeState& input,
|
|||
}
|
||||
|
||||
// special cases for non-integers
|
||||
if ((arg0_type.typespec() == TypeSpec("object") || arg0_type.typespec() == TypeSpec("pair")) &&
|
||||
if ((arg0_type.typespec() == TypeSpec("object") || arg0_type.typespec() == TypeSpec("pair") ||
|
||||
tc(dts, TypeSpec("basic"), arg0_type)) &&
|
||||
(arg1_type.is_integer_constant(62) || arg1_type.is_integer_constant(61))) {
|
||||
// boxed object tag trick.
|
||||
return TP_Type::make_from_ts("int");
|
||||
|
|
|
@ -2059,7 +2059,12 @@ void FunctionCallElement::update_from_stack(const Env& env,
|
|||
"type. Got {} instead.",
|
||||
tp_type.print()));
|
||||
}
|
||||
}
|
||||
|
||||
auto type_source_form = match_result.maps.forms.at(type_source);
|
||||
|
||||
// if the type is the exact type of the argument, we want to build it into a method call
|
||||
if (type_source_form->to_string(env) == first_arg_type.base_type() && name != "new") {
|
||||
if (env.dts->ts.should_use_virtual_methods(tp_type.method_from_type(),
|
||||
tp_type.method_id())) {
|
||||
throw std::runtime_error(fmt::format(
|
||||
|
@ -2067,12 +2072,6 @@ void FunctionCallElement::update_from_stack(const Env& env,
|
|||
":final in the deftype to disable virtual method calls",
|
||||
tp_type.method_from_type().print(), tp_type.method_id()));
|
||||
}
|
||||
}
|
||||
|
||||
auto type_source_form = match_result.maps.forms.at(type_source);
|
||||
|
||||
// if the type is the exact type of the argument, we want to build it into a method call
|
||||
if (type_source_form->to_string(env) == first_arg_type.base_type() && name != "new") {
|
||||
auto method_op = pool.alloc_single_element_form<ConstantTokenElement>(nullptr, name);
|
||||
auto gop = GenericOperator::make_function(method_op);
|
||||
|
||||
|
|
|
@ -126,7 +126,8 @@ bool run_type_analysis_ir2(const TypeSpec& my_type, DecompilerTypeSystem& dts, F
|
|||
} catch (std::runtime_error& e) {
|
||||
lg::warn("Function {} failed type prop at op {}: {}", func.guessed_name.to_string(),
|
||||
op_id, e.what());
|
||||
func.warnings.type_prop_warning("{}", e.what());
|
||||
func.warnings.type_prop_warning("Failed type prop at op {} ({})\n:{}", op_id,
|
||||
op->to_string(func.ir2.env), e.what());
|
||||
func.ir2.env.set_types(block_init_types, op_types, *func.ir2.atomic_ops, my_type);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4553,7 +4553,7 @@
|
|||
(:methods
|
||||
(dummy-9 (_type_ symbol) level 9)
|
||||
(dummy-10 (_type_ symbol) symbol 10)
|
||||
(dummy-11 (_type_ symbol symbol) _type_ 11)
|
||||
(dummy-11 (_type_ symbol symbol) level 11)
|
||||
(dummy-12 (_type_) none 12)
|
||||
(dummy-13 () none 13)
|
||||
(dummy-14 () none 14)
|
||||
|
|
|
@ -468,6 +468,7 @@
|
|||
"nassoc",
|
||||
"nassoce",
|
||||
"lookup-level-info",
|
||||
"(method 21 level-group)"
|
||||
"(method 21 level-group)",
|
||||
"bg"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -701,5 +701,9 @@
|
|||
],
|
||||
"on": [
|
||||
[33, "t9", "(function cpu-thread function none)"]
|
||||
],
|
||||
|
||||
"bg": [
|
||||
[37, "a0", "symbol"]
|
||||
]
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@
|
|||
(:methods
|
||||
(dummy-9 (_type_ symbol) level 9)
|
||||
(dummy-10 (_type_ symbol) symbol 10)
|
||||
(dummy-11 (_type_ symbol symbol) _type_ 11)
|
||||
(dummy-11 (_type_ symbol symbol) level 11)
|
||||
(dummy-12 (_type_) none 12)
|
||||
(dummy-13 () none 13)
|
||||
(dummy-14 () none 14)
|
||||
|
|
|
@ -291,7 +291,7 @@
|
|||
(:methods
|
||||
(dummy-9 (_type_ symbol) level 9)
|
||||
(dummy-10 (_type_ symbol) symbol 10)
|
||||
(dummy-11 (_type_ symbol symbol) _type_ 11)
|
||||
(dummy-11 (_type_ symbol symbol) level 11)
|
||||
(dummy-12 (_type_) none 12)
|
||||
(dummy-13 () none 13)
|
||||
(dummy-14 () none 14)
|
||||
|
|
Loading…
Reference in a new issue