Skip to content

arrays

Handle array-specific semantic helpers that are separate from tensor expression semantics.

Classes:

ExpressionArrayVisitorMixin

Bases: SemanticVisitorMixinBase

Methods:

visit

visit(node: ArrayInt32ArrayLength) -> None
Source code in packages/irx/src/irx/analysis/handlers/_expressions/arrays.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@SemanticAnalyzerCore.visit.dispatch
def visit(self, node: astx.ArrayInt32ArrayLength) -> None:
    """
    title: Visit ArrayInt32ArrayLength nodes.
    parameters:
      node:
        type: astx.ArrayInt32ArrayLength
    """
    for item in node.values:
        self.visit(item)
        if not is_integer_type(self._expr_type(item)):
            self.context.diagnostics.add(
                "Array helper supports only integer expressions",
                node=item,
            )
    self._set_type(node, astx.Int32())