compare_upstream: match XxxMT:Method and Class_Method globals to C++ class members (demo 100% ported by name)

This commit is contained in:
4DBug
2026-10-15 04:35:23 -05:00
parent d18bc714fc
commit 1e63710e33
2 changed files with 17 additions and 13 deletions
+13 -13
View File
@@ -16,12 +16,12 @@ imgui.cpp 786 87.4% 93.5% 75.0% 2
imgui_widgets.cpp 308 93.8% 98.7% 78.1% 1
imgui_draw.cpp 258 75.2% 75.5% 63.1% 2
imgui_tables.cpp 113 96.5% 99.0% 74.0% 0
imgui_demo.cpp 56 82.1% 98.2% 55.4% 0
imgui_demo.cpp 56 100.0% 100.0% 55.8% 0
imgui.h 110 53.6% 37.4% 56.7% 0
imgui_internal.h 269 61.3% 64.9% 68.0% 1
TOTAL 1900 81.5% 92.8% 70.7% 6
TOTAL 1900 82.1% 93.1% 70.7% 6
upstream code reproduced (similarity x ported size / all upstream size): 65.6%
upstream code reproduced (similarity x ported size / all upstream size): 65.8%
Public API (imgui.h, namespace ImGui) 368 / 376 97.9%
Internal API (imgui_internal.h, namespace ImGui) 417 / 443 94.1%
Enum values (imgui.h + imgui_internal.h) 1005 / 1078 93.2%
@@ -1804,14 +1804,14 @@ imgui_demo.cpp
[x] 66% DemoWindowWidgetsSelectables imgui_demo.lua:2584
-- DemoWindowWidgetsSelectionAndMultiSelect()
[ ] ExampleSelectionWithDeletion::ApplyDeletionPreLoop
[ ] ExampleSelectionWithDeletion::ApplyDeletionPostLoop
[ ] ExampleDualListBox::MoveAll
[ ] ExampleDualListBox::MoveSelected
[ ] ExampleDualListBox::ApplySelectionRequests
[ ] ExampleDualListBox::CompareItemsByValue
[ ] ExampleDualListBox::SortItems
[ ] ExampleDualListBox::Show
[x] 87% ExampleSelectionWithDeletion::ApplyDeletionPreLoop imgui_demo.lua:2774
[x] 84% ExampleSelectionWithDeletion::ApplyDeletionPostLoop imgui_demo.lua:2807
[x] 74% ExampleDualListBox::MoveAll imgui_demo.lua:2841
[x] 59% ExampleDualListBox::MoveSelected imgui_demo.lua:2851
[x] 74% ExampleDualListBox::ApplySelectionRequests imgui_demo.lua:2871
[x] 29% ExampleDualListBox::CompareItemsByValue imgui_demo.lua:2878
[x] 36% ExampleDualListBox::SortItems imgui_demo.lua:2881
[x] 90% ExampleDualListBox::Show imgui_demo.lua:2886
[x] 71% DemoWindowWidgetsSelectionAndMultiSelect imgui_demo.lua:3130
-- DemoWindowWidgetsTabs()
@@ -1844,8 +1844,8 @@ imgui_demo.cpp
-- DemoWindowPopups()
[x] 59% DemoWindowPopups imgui_demo.lua:5621
[ ] MyItem::SortWithSortSpecs
[ ] MyItem::CompareWithSortSpecs
[x] 36% MyItem::SortWithSortSpecs imgui_demo.lua:5939
[x] 68% MyItem::CompareWithSortSpecs imgui_demo.lua:5956
[x] 96% PushStyleCompact imgui_demo.lua:5983
[x] 100% PopStyleCompact imgui_demo.lua:5989
[x] 69% EditTableSizingFlags imgui_demo.lua:5996
+4
View File
@@ -268,6 +268,10 @@ def parse_lua():
j += 1
name = chain[-1]
cls = LUA_CLASS_ALIAS.get(chain[-2], chain[-2]) if len(chain) > 1 else None
if cls and cls.endswith("MT") and len(cls) > 2: cls = cls[:-2] # method tables: function ExampleAppLogMT:AddLog()
if cls is None and re.match(r"[A-Z]\w*_[A-Z]\w*$", name) and "__" not in name: # Class_Method globals (C++ static members)
c, _, m = name.partition("_")
defs.append(PortFunc(f, c, m, line, toks[body_start:j - 1]))
pf = PortFunc(f, cls, name, line, toks[body_start:j - 1])
bt = [x[1] for x in pf.body]
if len(bt) >= 5 and bt[0] == "return" and bt[-3:] == ["(", "...", ")"] and all(x[0] == "name" or x[1] in (".", ":") for x in pf.body[1:-3]):