Changeset 05246b3 in rtems-central


Ignore:
Timestamp:
May 11, 2020, 7:00:49 AM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
48082fc
Parents:
4dbae73
git-author:
Sebastian Huber <sebastian.huber@…> (05/11/20 07:00:49)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/28/20 08:38:22)
Message:

items: Add and use Link.role

Location:
rtemsqual
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • rtemsqual/interface.py

    r4dbae73 r05246b3  
    4040    ingroups = {}  # type: ItemMap
    4141    for link in item.links_to_parents():
    42         if link["role"] == "interface-ingroup":
     42        if link.role == "interface-ingroup":
    4343            ingroups[link.item.uid] = link.item
    4444    return ingroups
     
    6666            if item["interface-type"] == "enumerator":
    6767                for link in item.links_to_children():
    68                     if link["role"] == "interface-enumerator":
     68                    if link.role == "interface-enumerator":
    6969                        header_file.add_includes(link.item)
    7070            else:
     
    229229            enumerators = []  # type: List[CContent]
    230230            for link in self.item.links_to_parents():
    231                 if link["role"] != "interface-enumerator":
     231                if link.role != "interface-enumerator":
    232232                    continue
    233233                enumerator = _get_description(link.item, {})
     
    394394        self._includes = [
    395395            link.item for link in item.links_to_parents()
    396             if link["role"] == "interface-include"
     396            if link.role == "interface-include"
    397397        ]
    398398        self._nodes = {}  # type: Dict[str, Node]
     
    402402        """ Adds the includes of the item to the header file includes. """
    403403        for link in item.links_to_parents():
    404             if link["role"] == "interface-placement" and link.item[
     404            if link.role == "interface-placement" and link.item[
    405405                    "interface-type"] == "header-file":
    406406                self._includes.append(link.item)
     
    432432        """ Generates all nodes of this header file. """
    433433        for link in self._item.links_to_children():
    434             if link["role"] == "interface-placement":
     434            if link.role == "interface-placement":
    435435                self._add_child(link.item)
    436436        for node in self._nodes.values():
     
    518518    for uid in item_level_interfaces:
    519519        for link in item_cache[uid].links_to_children():
    520             if link["role"] == "interface-placement":
     520            if link.role == "interface-placement":
    521521                define = f"defined(${{{link.item.uid}:/interface-name}})"
    522522                enabled_by_defined[link.item["interface-name"]] = define
  • rtemsqual/items.py

    r4dbae73 r05246b3  
    108108        """ The item referenced by this link. """
    109109        return self._item
     110
     111    @property
     112    def role(self) -> str:
     113        """ The link role. """
     114        return self._data["role"]
    110115
    111116
  • rtemsqual/tests/test_items_item.py

    r4dbae73 r05246b3  
    9494    child = Item(EmptyCache(), "c", {})
    9595    parent = Item(EmptyCache(), "p", {})
    96     parent.add_link_to_child(Link(child, {"a": "b"}))
     96    parent.add_link_to_child(Link(child, {"a": "b", "role": "c"}))
    9797    children = [item for item in parent.children()]
    9898    assert len(children) == 1
     
    102102    assert links[0].item == child
    103103    assert links[0]["a"] == "b"
     104    assert links[0].role == "c"
    104105
    105106
Note: See TracChangeset for help on using the changeset viewer.