SubroutineCall

Calls a subroutine.

Declaration

Syntax

SubroutineCall(symbol name, symbol? original_name, call_arg* args,
    expr? dt, bool strict_bounds_checking)

Arguments

Argument

Description

name

the subroutine actually called, after generic resolution.

original_name

the symbol as written, when it differs: a GenericProcedure or an ExternalSymbol. nil when the call named the procedure directly.

args

the actual arguments, each a call_arg. An absent optional argument is a call_arg with a nil value.

dt

for a call through a type-bound procedure, the object it was reached through; nil otherwise.

strict_bounds_checking

true when the actual and dummy shapes must be checked to agree at run time.

Return values

None.

Description

Resolution has already happened when a SubroutineCall exists: name is the one procedure that runs. original_name keeps what the user wrote so that diagnostics and unparsing can show it.

An actual argument for an intent(out) or intent(inout) dummy must be writable: a variable, or a cast wrapper around one. Actual arguments are positional; keyword arguments are reordered by the frontend.

Examples

(SubroutineCall
  :name (SymbolRef 3 "reset")
  :original_name nil
  :args [
    (call_arg
      :value (Var
        :v (SymbolRef 3 "x")
      )
    )
  ]
  :dt nil
  :strict_bounds_checking false
)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "m" (Module
        :symtab (SymbolTable
          :id 1
          :symbols {
            "reset" (Function
              :symtab (SymbolTable
                :id 2
                :symbols {
                  "x" (Variable
                    :parent_symtab 2
                    :name "x"
                    :dependencies []
                    :intent :In
                    :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 []
                  )
                }
              )
              :name "reset"
              :function_signature (FunctionType
                :arg_types [
                  (Integer
                    :kind 4
                  )
                ]
                :return_var_type nil
                :abi :Source
                :deftype :Implementation
                :bindc_name nil
                :elemental false
                :pure false
                :module false
                :inline false
                :static false
                :restrictions []
                :is_restriction false
              )
              :dependencies []
              :args [
                (Var
                  :v (SymbolRef 2 "x")
                )
              ]
              :body []
              :return_var nil
              :access :Public
              :deterministic false
              :side_effect_free false
              :module_file nil
            )
          }
        )
        :name "m"
        :parent_module nil
        :dependencies []
        :loaded_from_mod false
        :intrinsic false
        :has_submodules false
      )
      "main" (Program
        :symtab (SymbolTable
          :id 3
          :symbols {
            "reset" (ExternalSymbol
              :parent_symtab 3
              :name "reset"
              :external (SymbolRef 1 "reset")
              :module_name "m"
              :scope_names []
              :original_name "reset"
              :access :Public
            )
            "x" (Variable
              :parent_symtab 3
              :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 []
            )
          }
        )
        :name "main"
        :dependencies [
          "m"
        ]
        :body [
          (SubroutineCall
            :name (SymbolRef 3 "reset")
            :original_name nil
            :args [
              (call_arg
                :value (Var
                  :v (SymbolRef 3 "x")
                )
              )
            ]
            :dt nil
            :strict_bounds_checking false
          )
        ]
      )
    }
  )
  :items []
)

See Also

FunctionCall, GenericProcedure, call_arg, Function