mercedes-benz/odxtools

use a context for the `_resolve_*()` methods

Opened this issue · 0 comments

currently most methods for resolving references (resolve_odxlinks() and _resolve_snrefs()) take the odxlinks database or the diagnostic layer as their argument. Unfortunately, this is not always sufficient because some of these methods require additional parameters (example). The approach currently taken is to introduce new _resolve_*() methods for affected classes which must be called instead of the generic versions. Alternatively it would be possible to pass an object describing the full calling context and let the called method determine the required information. E.g.

def _resolve_snrefs(self, context: CallingContext) -> None:
    params = context.parameters
    ...

Note that this would require a major refactoring because all classes would be affected and it might even make the code worse (in the sense of "more complicated")