StructConstant¶
A derived type constant.
Declaration¶
Syntax¶
StructConstant(symbol dt_sym, call_arg* args, ttype type)
Arguments¶
Argument |
Description |
|---|---|
|
the Struct the constant belongs to. |
|
the component values, all of them constants. |
|
the StructType of the value. |
Return values¶
The value of the expression.
Description¶
The folded form of a StructConstructor, used as the
value of a named constant of derived type and as a default initialiser. It
has no value member of its own, because it is one.
Examples¶
(StructConstant
:dt_sym (SymbolRef 3 "point")
:args [
(call_arg
:value (IntegerConstant
:n 0
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
)
(call_arg
:value (RealConstant
:r 0.0
:type (Real
:kind 4
)
)
)
]
:type (StructType
:data_member_types [
(Integer
:kind 4
)
(Real
:kind 4
)
]
:member_function_types []
:is_cstruct false
:is_unlimited_polymorphic false
)
)
It comes from this complete ASR text document:
(TranslationUnit
:symtab (SymbolTable
:id 0
:symbols {
"m" (Module
:symtab (SymbolTable
:id 1
:symbols {
"point" (Struct
:symtab (SymbolTable
:id 2
:symbols {
"x" (Variable
:parent_symtab 2
:name "x"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Integer
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
"y" (Variable
:parent_symtab 2
:name "y"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Real
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
}
)
:name "point"
:struct_signature (StructType
:data_member_types [
(Integer
:kind 4
)
(Real
:kind 4
)
]
:member_function_types []
:is_cstruct false
:is_unlimited_polymorphic false
)
:dependencies []
:members [
"x"
"y"
]
:member_functions []
:abi :Source
:access :Public
:is_packed false
:is_abstract false
:is_sequence false
:initializers []
:alignment nil
:parent nil
:kind_params []
)
}
)
:name "m"
:parent_module nil
:dependencies []
:loaded_from_mod false
:intrinsic false
:has_submodules false
)
"main" (Program
:symtab (SymbolTable
:id 3
:symbols {
"origin" (Variable
:parent_symtab 3
:name "origin"
:dependencies []
:intent :Local
:symbolic_value (StructConstant
:dt_sym (SymbolRef 3 "point")
:args [
(call_arg
:value (IntegerConstant
:n 0
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
)
(call_arg
:value (RealConstant
:r 0.0
:type (Real
:kind 4
)
)
)
]
:type (StructType
:data_member_types [
(Integer
:kind 4
)
(Real
:kind 4
)
]
:member_function_types []
:is_cstruct false
:is_unlimited_polymorphic false
)
)
:value (StructConstant
:dt_sym (SymbolRef 3 "point")
:args [
(call_arg
:value (IntegerConstant
:n 0
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
)
(call_arg
:value (RealConstant
:r 0.0
:type (Real
:kind 4
)
)
)
]
:type (StructType
:data_member_types [
(Integer
:kind 4
)
(Real
:kind 4
)
]
:member_function_types []
:is_cstruct false
:is_unlimited_polymorphic false
)
)
:storage :Parameter
:type (StructType
:data_member_types [
(Integer
:kind 4
)
(Real
:kind 4
)
]
:member_function_types []
:is_cstruct false
:is_unlimited_polymorphic false
)
:type_declaration (SymbolRef 3 "point")
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
"point" (ExternalSymbol
:parent_symtab 3
:name "point"
:external (SymbolRef 1 "point")
:module_name "m"
:scope_names []
:original_name "point"
:access :Public
)
}
)
:name "main"
:dependencies [
"m"
]
:body []
)
}
)
:items []
)