ArrayItem

Array item, value stored at each index.

声明

语法

ArrayItem(expr v, array_index* args, ttype type, arraystorage storage_format, expr? value)

参数

Argument Name

Argument Description

v

表达

args

array indeces

type

table entry type

storage_format

array storage format

value

expression value

返回值

The return value is the expression that the ArrayItem represents.

描述

ArrayItem represents Array Item.

类型

Only accepts array indexes.

示例

integer :: a(2)
a(0) = 0
a(1) = 1

ASR:

(TranslationUnit
    (SymbolTable
        1
        {
            a:
                (Variable
                    1
                    a
                    Local
                    ()
                    ()
                    Default
                    (Integer 4 [((IntegerConstant 1 (Integer 4 []))
                    (IntegerConstant 2 (Integer 4 [])))])
                    Source
                    Public
                    Required
                    .false.
                )

        })
    [(=
        (ArrayItem
            (Var 1 a)
            [(()
            (IntegerConstant 0 (Integer 4 []))
            ())]
            (Integer 4 [])
            ()
        )
        (IntegerConstant 0 (Integer 4 []))
        ()
    )
    (=
        (ArrayItem
            (Var 1 a)
            [(()
            (IntegerConstant 1 (Integer 4 []))
            ())]
            (Integer 4 [])
            ()
        )
        (IntegerConstant 1 (Integer 4 []))
        ()
    )]
)

也可以看看

ArrayConstant