Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions parser/object_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,19 @@ def _ooname(fn_name: str, cls: str) -> str:

def _oo_excluded(fn: dict, role: str) -> bool:
"""True for functions classified to a class that are internal machinery,
not user OO methods: aggregate transition helpers, and comparators with no
SQL function (qsort / bound / min / max sort helpers)."""
not user OO methods: functions the catalog marks internal (the ``_p`` peeks,
the bbox / skiplist plumbing, ``*_in`` / ``*_out``), aggregate transition
helpers, and comparators with no SQL function (qsort / bound / min / max sort
helpers).

The internal-API check is the load-bearing one for a binding that generates
its object layer from ``classes[*].methods``: without it that list mixes the
public surface with functions a binding cannot call, so every binding would
re-derive the split. The catalog carries ``api`` per function, so the method
carries the exclusion and a binding keeps only ``not m['ooExclude']``."""
name = fn["name"]
if fn.get("api") != "public":
return True
if any(name.endswith(s) for s in _OONAME_EXCLUDE_SUFFIXES):
return True
if role == "predicate" and not fn.get("sqlfn"):
Expand Down
13 changes: 13 additions & 0 deletions tests/test_object_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ def test_classification(self):
self.assertIsNone(ftc["add_int_int"]["class"])
self.assertIn("no-prefix-match", ftc["add_int_int"]["reason"])

def test_internal_api_methods_are_excluded(self):
# A function the catalog marks internal is classified to its class (so
# the reverse index stays complete) but flagged ooExclude, so a binding
# generating from classes[*].methods keeps only the public surface.
idl = attach_object_model({"functions": [
{"name": "temporal_num_instants", "api": "public"},
{"name": "temporal_inst_n", "api": "internal"},
]}, MODEL, None)
meths = {m["backing"]: m
for m in idl["objectModel"]["classes"]["Temporal"]["methods"]}
self.assertNotIn("ooExclude", meths["temporal_num_instants"])
self.assertTrue(meths["temporal_inst_n"].get("ooExclude"))

def test_tree_derived(self):
om = self._attach(["temporal_merge"])["objectModel"]
lat = om["lattice"]
Expand Down
Loading