summaryrefslogtreecommitdiffstats
path: root/rtemsqual/interface.py
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-06-26 20:01:46 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-07-03 10:22:46 +0200
commit0dada0449d51ef50c7d19d4130866d7a7360abcf (patch)
treeee36739478723d562ac7fa9905b1a69e7acb3708 /rtemsqual/interface.py
parentitems: Add support for aggregated item type (diff)
downloadrtems-central-0dada0449d51ef50c7d19d4130866d7a7360abcf.tar.bz2
items: Add ItemGetValueContext
Use aggregated item type in get_value() methods.
Diffstat (limited to 'rtemsqual/interface.py')
-rw-r--r--rtemsqual/interface.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/rtemsqual/interface.py b/rtemsqual/interface.py
index 22e7aa94..90a0245b 100644
--- a/rtemsqual/interface.py
+++ b/rtemsqual/interface.py
@@ -26,11 +26,11 @@
from contextlib import contextmanager
import os
-from typing import Any, Callable, Dict, Iterator, List, Optional, Union
+from typing import Any, Callable, Dict, Iterator, List, Union
from rtemsqual.content import CContent, CInclude, enabled_by_to_exp, \
ExpressionMapper
-from rtemsqual.items import Item, ItemCache, ItemMapper
+from rtemsqual.items import Item, ItemCache, ItemGetValueContext, ItemMapper
ItemMap = Dict[str, Item]
Lines = Union[str, List[str]]
@@ -82,14 +82,14 @@ class _InterfaceMapper(ItemMapper):
header_file.add_potential_edge(node, item)
return value
- def get_value(self, item: Item, path: str, value: Any, key: str,
- _index: Optional[int]) -> Any:
- if path == "/" and key == "name" and item["type"] == "interface":
- interface_type = item["interface-type"]
+ def get_value(self, ctx: ItemGetValueContext) -> Any:
+ if ctx.path == "/" and ctx.key == "name" and ctx.item[
+ "type"] == "interface":
+ interface_type = ctx.item["interface-type"]
if interface_type == "forward-declaration":
- return _forward_declaration(item)
+ return _forward_declaration(ctx.item)
if not self._eval_interface:
- value = value[key]
+ value = ctx.value[ctx.key]
if interface_type == "function":
return f"{value}()"
if interface_type in ["enumerator", "typedef"]: