Class: SFRP::Raw::SequenceExp
- Inherits:
-
Struct
- Object
- Struct
- SFRP::Raw::SequenceExp
- Defined in:
- lib/sfrp/raw/expression.rb
Instance Attribute Summary collapse
-
#exps ⇒ Object
Returns the value of attribute exps.
-
#func_refs ⇒ Object
Returns the value of attribute func_refs.
-
#sp ⇒ Object
Returns the value of attribute sp.
Instance Method Summary collapse
- #blame_side_effect ⇒ Object
- #convert(set, ns) ⇒ Object
- #to_flat(set, ns) ⇒ Object
- #vconst_refs ⇒ Object
Instance Attribute Details
#exps ⇒ Object
Returns the value of attribute exps
102 103 104 |
# File 'lib/sfrp/raw/expression.rb', line 102 def exps @exps end |
#func_refs ⇒ Object
Returns the value of attribute func_refs
102 103 104 |
# File 'lib/sfrp/raw/expression.rb', line 102 def func_refs @func_refs end |
#sp ⇒ Object
Returns the value of attribute sp
102 103 104 |
# File 'lib/sfrp/raw/expression.rb', line 102 def sp @sp end |
Instance Method Details
#blame_side_effect ⇒ Object
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_refs ⇒ Object
103 104 105 |
# File 'lib/sfrp/raw/expression.rb', line 103 def vconst_refs exps.flat_map(&:vconst_refs) end |