mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 00:57:44 -04:00
fixes
This commit is contained in:
parent
9100725802
commit
f3d871f60a
|
@ -2993,7 +2993,7 @@ void FunctionCallElement::update_from_stack(const Env& env,
|
||||||
auto temp_form = pool.alloc_single_form(nullptr, new_form);
|
auto temp_form = pool.alloc_single_form(nullptr, new_form);
|
||||||
auto match_result = match(matcher, temp_form);
|
auto match_result = match(matcher, temp_form);
|
||||||
if (match_result.matched) {
|
if (match_result.matched) {
|
||||||
auto& type_1 = match_result.maps.strings.at(type_for_method);
|
auto type_1 = match_result.maps.strings.at(type_for_method);
|
||||||
auto& name = match_result.maps.strings.at(method_name);
|
auto& name = match_result.maps.strings.at(method_name);
|
||||||
|
|
||||||
if (name == "new" && type_1 == "object") {
|
if (name == "new" && type_1 == "object") {
|
||||||
|
@ -3042,7 +3042,7 @@ void FunctionCallElement::update_from_stack(const Env& env,
|
||||||
alloc != "loading-level") {
|
alloc != "loading-level") {
|
||||||
throw std::runtime_error("Unrecognized heap symbol for new: " + alloc);
|
throw std::runtime_error("Unrecognized heap symbol for new: " + alloc);
|
||||||
}
|
}
|
||||||
auto& type_2 = match_result.maps.strings.at(type_for_arg);
|
auto type_2 = match_result.maps.strings.at(type_for_arg);
|
||||||
if (type_1 != type_2) {
|
if (type_1 != type_2) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
fmt::format("Inconsistent types in method call: {} and {}", type_1, type_2));
|
fmt::format("Inconsistent types in method call: {} and {}", type_1, type_2));
|
||||||
|
@ -3096,7 +3096,7 @@ void FunctionCallElement::update_from_stack(const Env& env,
|
||||||
auto temp_form = pool.alloc_single_form(nullptr, new_form);
|
auto temp_form = pool.alloc_single_form(nullptr, new_form);
|
||||||
auto match_result = match(matcher, temp_form);
|
auto match_result = match(matcher, temp_form);
|
||||||
if (match_result.matched) {
|
if (match_result.matched) {
|
||||||
auto& name = match_result.maps.strings.at(method_name);
|
auto name = match_result.maps.strings.at(method_name);
|
||||||
if (name != "new") {
|
if (name != "new") {
|
||||||
// only do these checks on non-new methods. New methods are treated as functions because
|
// only do these checks on non-new methods. New methods are treated as functions because
|
||||||
// they are never virtual and are never called like a method.
|
// they are never virtual and are never called like a method.
|
||||||
|
|
|
@ -27,7 +27,7 @@ bool convert_to_expressions(
|
||||||
f.guessed_name.kind == FunctionName::FunctionKind::V_STATE) {
|
f.guessed_name.kind == FunctionName::FunctionKind::V_STATE) {
|
||||||
f.ir2.env.set_remap_for_function(f.type);
|
f.ir2.env.set_remap_for_function(f.type);
|
||||||
} else if (f.guessed_name.kind == FunctionName::FunctionKind::METHOD) {
|
} else if (f.guessed_name.kind == FunctionName::FunctionKind::METHOD) {
|
||||||
auto method_type =
|
auto& method_type =
|
||||||
dts.ts.lookup_method(f.guessed_name.type_name, f.guessed_name.method_id).type;
|
dts.ts.lookup_method(f.guessed_name.type_name, f.guessed_name.method_id).type;
|
||||||
if (f.guessed_name.method_id == GOAL_NEW_METHOD) {
|
if (f.guessed_name.method_id == GOAL_NEW_METHOD) {
|
||||||
f.ir2.env.set_remap_for_new_method(method_type);
|
f.ir2.env.set_remap_for_new_method(method_type);
|
||||||
|
|
|
@ -260,10 +260,10 @@ void FormRegressionTest::test(const std::string& code,
|
||||||
auto ts = dts->parse_type_spec(type);
|
auto ts = dts->parse_type_spec(type);
|
||||||
auto test = make_function(code, ts, settings);
|
auto test = make_function(code, ts, settings);
|
||||||
ASSERT_TRUE(test);
|
ASSERT_TRUE(test);
|
||||||
auto expected_form =
|
auto& expected_form =
|
||||||
pretty_print::get_pretty_printer_reader().read_from_string(expected, false).as_pair()->car;
|
pretty_print::get_pretty_printer_reader().read_from_string(expected, false).as_pair()->car;
|
||||||
ASSERT_TRUE(test->func.ir2.top_form);
|
ASSERT_TRUE(test->func.ir2.top_form);
|
||||||
auto actual_form =
|
auto& actual_form =
|
||||||
pretty_print::get_pretty_printer_reader()
|
pretty_print::get_pretty_printer_reader()
|
||||||
.read_from_string(test->func.ir2.top_form->to_form(test->func.ir2.env).print(), false)
|
.read_from_string(test->func.ir2.top_form->to_form(test->func.ir2.env).print(), false)
|
||||||
.as_pair()
|
.as_pair()
|
||||||
|
@ -322,4 +322,4 @@ void FormRegressionTest::test_with_stack_structures(const std::string& code,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<InstructionParser> FormRegressionTest::parser;
|
std::unique_ptr<InstructionParser> FormRegressionTest::parser;
|
||||||
std::unique_ptr<DecompilerTypeSystem> FormRegressionTest::dts;
|
std::unique_ptr<DecompilerTypeSystem> FormRegressionTest::dts;
|
||||||
|
|
Loading…
Reference in a new issue