From: Dmitry Selyutin Date: Fri, 23 Jun 2023 08:28:21 +0000 (+0300) Subject: visitor: support additional arguments X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f5695de23d627f9bcc7857cc01dff270edf57f7d;p=mdis.git visitor: support additional arguments --- diff --git a/src/mdis/visitor.py b/src/mdis/visitor.py index ff26172..d742268 100644 --- a/src/mdis/visitor.py +++ b/src/mdis/visitor.py @@ -15,12 +15,12 @@ class VisitorMeta(dispatcher.DispatcherMeta): class Visitor(dispatcher.Dispatcher, metaclass=VisitorMeta): @dispatcher.Hook(object) - def dispatch_object(self, node): + def dispatch_object(self, node, *arguments): return node class ContextVisitor(Visitor): @dispatcher.Hook(object) @contextlib.contextmanager - def dispatch_object(self, node): - yield super().__call__(node) + def dispatch_object(self, node, *arguments): + yield super().__call__(node, *arguments)