88from _libyang import ffi , lib
99from .context import Context
1010from .log import get_libyang_level
11- from .schema import ExtensionCompiled , ExtensionParsed , Module
11+ from .schema import ExtensionCompiled , ExtensionParsed , Module , SNode
1212from .util import LibyangError , c2str , str2c
1313
1414
@@ -25,7 +25,7 @@ def __init__(self, message: str, ret: int, log_level: int) -> None:
2525
2626@ffi .def_extern (name = "lypy_lyplg_ext_parse_clb" )
2727def libyang_c_lyplg_ext_parse_clb (pctx , pext ):
28- plugin = extensions_plugins [pext .record . plugin ]
28+ plugin = extensions_plugins [lib . lysc_get_ext_plugin ( pext .plugin_ref ) ]
2929 module_cdata = lib .lyplg_ext_parse_get_cur_pmod (pctx ).mod
3030 context = Context (cdata = module_cdata .ctx )
3131 module = Module (context , module_cdata )
@@ -46,7 +46,7 @@ def libyang_c_lyplg_ext_parse_clb(pctx, pext):
4646
4747@ffi .def_extern (name = "lypy_lyplg_ext_compile_clb" )
4848def libyang_c_lyplg_ext_compile_clb (cctx , pext , cext ):
49- plugin = extensions_plugins [pext .record . plugin ]
49+ plugin = extensions_plugins [lib . lysc_get_ext_plugin ( pext .plugin_ref ) ]
5050 context = Context (cdata = lib .lyplg_ext_compile_get_ctx (cctx ))
5151 module = Module (context , cext .module )
5252 parsed_ext = ExtensionParsed (context , pext , module )
@@ -67,7 +67,7 @@ def libyang_c_lyplg_ext_compile_clb(cctx, pext, cext):
6767
6868@ffi .def_extern (name = "lypy_lyplg_ext_parse_free_clb" )
6969def libyang_c_lyplg_ext_parse_free_clb (ctx , pext ):
70- plugin = extensions_plugins [pext .record . plugin ]
70+ plugin = extensions_plugins [lib . lysc_get_ext_plugin ( pext .plugin_ref ) ]
7171 context = Context (cdata = ctx )
7272 parsed_ext = ExtensionParsed (context , pext , None )
7373 plugin .parse_free_clb (parsed_ext )
@@ -200,9 +200,17 @@ def set_compile_ctx(self, cctx) -> None:
200200 def parse_substmts (self , ext : ExtensionParsed ) -> int :
201201 return lib .lyplg_ext_parse_extension_instance (self ._pctx , ext .cdata )
202202
203- def compile_substmts (self , pext : ExtensionParsed , cext : ExtensionCompiled ) -> int :
203+ def compile_substmts (
204+ self ,
205+ pext : ExtensionParsed ,
206+ cext : ExtensionCompiled ,
207+ parent : Optional [SNode ] = None ,
208+ ) -> int :
204209 return lib .lyplg_ext_compile_extension_instance (
205- self ._cctx , pext .cdata , cext .cdata
210+ self ._cctx ,
211+ pext .cdata ,
212+ cext .cdata ,
213+ ffi .NULL if parent is None else parent .cdata ,
206214 )
207215
208216 def free_parse_substmts (self , ext : ExtensionParsed ) -> None :
0 commit comments