feat: map Piklib 6.1 types through constructor-created runners

Piklib 6.1 predates CMC_RunnerFactory; each class constructor creates its
own runner. The extractor records class -> runner from those call sites
(runner_map.by_class) and the tracker walks the snapshot's constructor
chain from a type's class to the nearest one creating a runner, so 6.1
variable and condition types no longer fall into pseudo-types either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Patryk Gensch
2026-10-24 18:59:58 +02:00
co-authored by Claude Opus 5.5
parent edae0929d7
commit 11f4b6fc37
4 changed files with 71 additions and 4 deletions
+15
View File
@@ -262,3 +262,18 @@ def test_shared_runner_methods_follow_per_type_verdicts(tmp_path):
assert row(result, "STRING", "ADD")["signatures"] == ["(int) → copy"]
assert any("bez efektu" in n for n in row(result, "INTEGER", "ADD")["notes"])
assert row(result, "INTEGER", "ADD")["original"][0]["per_type"] == "trivial_virtual"
def test_class_constructor_runners_map_piklib61_types(tmp_path):
snap = Snapshot({"binary": {"name": "p61.dll", "sha256": SHA},
"types": [{"script_name": "INTEGER", "cpp_class": None}, {"script_name": "CONDITION", "cpp_class": None}],
"methods": [{"owner": "CMC_Variable", "runner": "CMC_Variable_Runner", "name": "inc", "id": None},
{"owner": "CMC_BasicCondition", "runner": "CMC_BasicCondition_Runner", "name": "check", "id": None}],
"field_inheritance": [{"class": "CMC_Integer", "base_class": "CMC_Variable"},
{"class": "CMC_Condition", "base_class": "CMC_BasicCondition"}],
"runner_map": {"by_class": [{"class": "CMC_Variable", "runner": "CMC_Variable_Runner"},
{"class": "CMC_BasicCondition", "runner": "CMC_BasicCondition_Runner"}]}})
result = build_tracker([snap], emulator(tmp_path))
assert row(result, "INTEGER", "INC")["original"][0]["mapping"] == "class_constructor"
assert row(result, "CONDITION", "CHECK")["original"]
assert not {"VARIABLE", "BASICCONDITION"} & {t["name"] for t in result["types"]}