Class: SFRP::Raw::LetExp

Inherits:
Struct
  • Object
show all
Includes:
SugarExp
Defined in:
lib/sfrp/raw/expression.rb

Defined Under Namespace

Classes: Assignment

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SugarExp

#blame_side_effect, #to_flat, #vconst_refs

Instance Attribute Details

#assignmentsObject

Returns the value of attribute assignments

Returns:

  • (Object)

    the current value of assignments



155
156
157
# File 'lib/sfrp/raw/expression.rb', line 155

def assignments
  @assignments
end

#expObject

Returns the value of attribute exp

Returns:

  • (Object)

    the current value of exp



155
156
157
# File 'lib/sfrp/raw/expression.rb', line 155

def exp
  @exp
end

#spObject

Returns the value of attribute sp

Returns:

  • (Object)

    the current value of sp



155
156
157
# File 'lib/sfrp/raw/expression.rb', line 155

def sp
  @sp
end

Instance Method Details

#convertObject



160
161
162
163
164
165
# File 'lib/sfrp/raw/expression.rb', line 160

def convert
  raise if assignments.empty?
  assignments.reverse.reduce(exp) do |e, ass|
    MatchExp.new(ass.exp, [MatchExp::Case.new(ass.pattern, e)], sp)
  end
end