Skip to content

structs

Classes:

FieldAccess

FieldAccess(value: AST, field_name: str)

Bases: DataType

Methods:

Source code in src/irx/astx/structs.py
 99
100
101
102
103
104
105
106
107
108
109
110
111
def __init__(self, value: astx.AST, field_name: str) -> None:
    """
    title: Initialize one field access expression.
    parameters:
      value:
        type: astx.AST
      field_name:
        type: str
    """
    super().__init__()
    self.value = value
    self.field_name = field_name
    self.type_ = AnyType()

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in src/irx/astx/structs.py
121
122
123
124
125
126
127
128
129
130
131
132
def get_struct(self, simplified: bool = False) -> astx.base.ReprStruct:
    """
    title: Build one repr structure for a field access expression.
    parameters:
      simplified:
        type: bool
    returns:
      type: astx.base.ReprStruct
    """
    key = f"FIELD-ACCESS[{self.field_name}]"
    value = self.value.get_struct(simplified)
    return self._prepare_struct(key, value, simplified)

StructType

StructType(
    name: str,
    *,
    resolved_name: str | None = None,
    module_key: str | None = None,
    qualified_name: str | None = None,
)

Bases: AnyType

Methods:

Source code in src/irx/astx/structs.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def __init__(
    self,
    name: str,
    *,
    resolved_name: str | None = None,
    module_key: str | None = None,
    qualified_name: str | None = None,
) -> None:
    """
    title: Initialize one named struct type reference.
    parameters:
      name:
        type: str
      resolved_name:
        type: str | None
      module_key:
        type: str | None
      qualified_name:
        type: str | None
    """
    super().__init__()
    self.name = name
    self.resolved_name = resolved_name
    self.module_key = module_key
    self.qualified_name = qualified_name

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in src/irx/astx/structs.py
68
69
70
71
72
73
74
75
76
77
78
79
def get_struct(self, simplified: bool = False) -> astx.base.ReprStruct:
    """
    title: Build one repr structure for a struct type reference.
    parameters:
      simplified:
        type: bool
    returns:
      type: astx.base.ReprStruct
    """
    key = f"STRUCT-TYPE[{self.name}]"
    value = self.qualified_name or self.name
    return self._prepare_struct(key, value, simplified)