@@ -1019,8 +1019,6 @@ def __init__(
10191019 # Public, some of which are initialized properly later:
10201020 self .edt : 'EDT' = edt
10211021 self .dep_ordinal : int = - 1
1022- self .matching_compat : Optional [str ] = None
1023- self .binding_path : Optional [str ] = None
10241022 self .compats : List [str ] = compats
10251023 self .ranges : List [Range ] = []
10261024 self .regs : List [Register ] = []
@@ -1139,6 +1137,20 @@ def read_only(self) -> bool:
11391137 "See the class docstring"
11401138 return "read-only" in self ._node .props
11411139
1140+ @property
1141+ def matching_compat (self ) -> Optional [str ]:
1142+ "See the class docstring"
1143+ if self ._binding :
1144+ return self ._binding .compatible
1145+ return None
1146+
1147+ @property
1148+ def binding_path (self ) -> Optional [str ]:
1149+ "See the class docstring"
1150+ if self ._binding :
1151+ return self ._binding .path
1152+ return None
1153+
11421154 @property
11431155 def aliases (self ) -> List [str ]:
11441156 "See the class docstring"
@@ -1258,12 +1270,9 @@ def __repr__(self) -> str:
12581270 return f"<Node { self .path } in '{ self .edt .dts_path } ', { binding } >"
12591271
12601272 def _init_binding (self ) -> None :
1261- # Initializes Node.matching_compat, Node._binding, and
1262- # Node.binding_path.
1263- #
1264- # Node._binding holds the data from the node's binding file, in the
1265- # format returned by PyYAML (plain Python lists, dicts, etc.), or None
1266- # if the node has no binding.
1273+ # Initializes Node._binding. It holds data from the node's binding file,
1274+ # in the format returned by PyYAML (plain Python lists, dicts, etc.), or
1275+ # None if the node has no binding.
12671276
12681277 # This relies on the parent of the node having already been
12691278 # initialized, which is guaranteed by going through the nodes in
@@ -1295,8 +1304,6 @@ def _init_binding(self) -> None:
12951304 else :
12961305 continue
12971306
1298- self .binding_path = binding .path
1299- self .matching_compat = compat
13001307 self ._binding = binding
13011308 return
13021309 else :
@@ -1307,13 +1314,10 @@ def _init_binding(self) -> None:
13071314 binding_from_parent = self ._binding_from_parent ()
13081315 if binding_from_parent :
13091316 self ._binding = binding_from_parent
1310- self .binding_path = self ._binding .path
1311- self .matching_compat = self ._binding .compatible
1312-
13131317 return
13141318
13151319 # No binding found
1316- self ._binding = self . binding_path = self . matching_compat = None
1320+ self ._binding = None
13171321
13181322 def _binding_from_properties (self ) -> None :
13191323 # Sets up a Binding object synthesized from the properties in the node.
@@ -1354,8 +1358,6 @@ def _binding_from_properties(self) -> None:
13541358 raw ['properties' ][name ] = pp
13551359
13561360 # Set up Node state.
1357- self .binding_path = None
1358- self .matching_compat = None
13591361 self .compats = []
13601362 self ._binding = Binding (None , {}, raw = raw , require_compatible = False )
13611363
0 commit comments