mirror of
https://github.com/open-goal/jak-project
synced 2026-08-03 08:53:42 -04:00
jak 1
This commit is contained in:
@@ -3896,6 +3896,7 @@ void FunctionCallElement::update_from_stack(const Env& env,
|
||||
{
|
||||
const auto& guessed_name = env.func->guessed_name;
|
||||
if (guessed_name.kind == FunctionName::FunctionKind::METHOD) {
|
||||
// detect stuff like: ((find-parent-method...) arg...)
|
||||
auto mr_find_parent =
|
||||
match(Matcher::func(Matcher::symbol("find-parent-method"),
|
||||
{Matcher::symbol(env.func->method_of_type),
|
||||
@@ -3908,6 +3909,22 @@ void FunctionCallElement::update_from_stack(const Env& env,
|
||||
GenericOperator::make_function(pool.form<ConstantTokenElement>("call-parent-method")),
|
||||
arg_forms);
|
||||
}
|
||||
} else if (guessed_name.kind == FunctionName::FunctionKind::V_STATE && arg_forms.size() == 2) {
|
||||
// here, simply detect (find-parent-method...)
|
||||
//
|
||||
auto mr_find_parent = match(Matcher::symbol("find-parent-method"), unstacked.at(0));
|
||||
if (mr_find_parent.matched) {
|
||||
auto state_info =
|
||||
env.dts->ts.lookup_method(guessed_name.type_name, guessed_name.state_name);
|
||||
if (arg_forms.at(0)->to_string(env) == guessed_name.type_name &&
|
||||
arg_forms.at(1)->to_string(env) == std::to_string(state_info.id)) {
|
||||
new_form = pool.alloc_element<GenericElement>(
|
||||
GenericOperator::make_function(pool.form<ConstantTokenElement>("find-parent-state")));
|
||||
} else {
|
||||
printf("BAD match [%s] [%s]\n", arg_forms.at(0)->to_string(env).c_str(),
|
||||
arg_forms.at(1)->to_string(env).c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user