GoToTarget

A labelled statement: the target of zero or more jumps.

Declaration

Syntax

GoToTarget(int id, identifier name)

Arguments

Argument

Description

id

the identifier GoTo uses to reach this statement. It is unique within the procedure.

name

the label as it was written.

Return values

None.

Description

GoToTarget does nothing when it is executed. It marks a position in the statement list so that a GoTo, an IfArithmetic or an err= specifier can name it.

A target may be jumped to from several places, or from none, in which case it is dead and later passes may remove it.

Examples

(GoToTarget
  :id 100
  :name "100"
)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "main" (Program
        :symtab (SymbolTable
          :id 1
          :symbols {
            "i" (Variable
              :parent_symtab 1
              :name "i"
              :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 []
            )
            "label" (Variable
              :parent_symtab 1
              :name "label"
              :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 []
        :body [
          (Assign
            :label 100
            :variable "label"
          )
          (GoTo
            :target_id 100
            :name "100"
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "i")
            )
            :value (IntegerConstant
              :n 1
              :type (Integer
                :kind 4
              )
              :intboz_type :Decimal
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
          )
          (GoToTarget
            :id 100
            :name "100"
          )
          (IfArithmetic
            :test (Var
              :v (SymbolRef 1 "i")
            )
            :lt_label 100
            :eq_label 100
            :gt_label 100
          )
        ]
      )
    }
  )
  :items []
)

See Also

GoTo, IfArithmetic