add base for ir gen

This commit is contained in:
2025-10-15 02:00:23 +05:30
parent d3f0e3b2ef
commit 11e8e72188
3 changed files with 43 additions and 3 deletions

View File

@ -147,3 +147,23 @@ class DependencyHandler:
int: The number of nodes
"""
return len(self._nodes)
def __getitem__(self, name: str) -> DependencyNode:
"""
Get a node by name using dictionary-style access.
Args:
name: The name of the node to retrieve
Returns:
DependencyNode: The node with the given name
Raises:
KeyError: If no node with the given name exists
Example:
node = handler["some-dep_node_name"]
"""
if name not in self._nodes:
raise KeyError(f"No node with name '{name}' found")
return self._nodes[name]