Class: SFRP::Raw::SequenceExp

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#expsObject

Returns the value of attribute exps

Returns:

  • (Object)

    the current value of exps



102
103
104
# File 'lib/sfrp/raw/expression.rb', line 102

def exps
  @exps
end

#func_refsObject

Returns the value of attribute func_refs

Returns:

  • (Object)

    the current value of func_refs



102
103
104
# File 'lib/sfrp/raw/expression.rb', line 102

def func_refs
  @func_refs
end

#spObject

Returns the value of attribute sp

Returns:

  • (Object)

    the current value of sp



102
103
104
# File 'lib/sfrp/raw/expression.rb', line 102

def sp
  @sp
end

Instance Method Details

#blame_side_effectObject



107
108
109
# File 'lib/sfrp/raw/expression.rb', line 107

def blame_side_effect
  exps.each { |e| e.blame_side_effect }
end

#convert(set, ns) ⇒ Object



111
112
113
114
115
116
117
118
# File 'lib/sfrp/raw/expression.rb', line 111

def convert(set, ns)
  return exps[0] if exps.size == 1
  pos = set.weakest_op_position(ns, func_refs, sp)
  lseq = SequenceExp.new(exps.take(pos + 1), func_refs.take(pos), sp)
  rseq = SequenceExp.new(exps.drop(pos + 1), func_refs.drop(pos + 1), sp)
  args = [lseq.convert(set, ns), rseq.convert(set, ns)]
  FuncCallExp.new(func_refs[pos], args, false, sp)
end

#to_flat(set, ns) ⇒ Object



120
121
122
# File 'lib/sfrp/raw/expression.rb', line 120

def to_flat(set, ns)
  convert(set, ns).to_flat(set, ns)
end

#vconst_refsObject



103
104
105
# File 'lib/sfrp/raw/expression.rb', line 103

def vconst_refs
  exps.flat_map(&:vconst_refs)
end