Class: SFRP::Flat::Node
- Inherits:
-
Struct
- Object
- Struct
- SFRP::Flat::Node
- Defined in:
- lib/sfrp/flat/elements.rb
Instance Attribute Summary collapse
-
#exp ⇒ Object
Returns the value of attribute exp.
-
#init_exp ⇒ Object
Returns the value of attribute init_exp.
-
#sp ⇒ Object
Returns the value of attribute sp.
-
#str ⇒ Object
Returns the value of attribute str.
-
#ta ⇒ Object
Returns the value of attribute ta.
Instance Method Summary collapse
Instance Attribute Details
#exp ⇒ Object
Returns the value of attribute exp
42 43 44 |
# File 'lib/sfrp/flat/elements.rb', line 42 def exp @exp end |
#init_exp ⇒ Object
Returns the value of attribute init_exp
42 43 44 |
# File 'lib/sfrp/flat/elements.rb', line 42 def init_exp @init_exp end |
#sp ⇒ Object
Returns the value of attribute sp
42 43 44 |
# File 'lib/sfrp/flat/elements.rb', line 42 def sp @sp end |
#str ⇒ Object
Returns the value of attribute str
42 43 44 |
# File 'lib/sfrp/flat/elements.rb', line 42 def str @str end |
#ta ⇒ Object
Returns the value of attribute ta
42 43 44 |
# File 'lib/sfrp/flat/elements.rb', line 42 def ta @ta end |
Instance Method Details
#initialized? ⇒ Boolean
43 44 45 |
# File 'lib/sfrp/flat/elements.rb', line 43 def initialized? !init_exp.nil? end |
#to_poly(src_set, dest_set) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/sfrp/flat/elements.rb', line 47 def to_poly(src_set, dest_set) dest_set << P.node(str, ta && ta.to_poly) do |n| collected_node_refs = [] poly_exp = exp.alpha_convert({}, (0..1000).to_a) .lift_node_ref(collected_node_refs).to_poly collected_node_refs.each do |nr| if nr.last && !src_set.node(nr.node_str).initialized? raise NodeInvalidLastReferrenceError.new(nr.node_str) end nr.last ? n.l(nr.node_str) : n.c(nr.node_str) end dest_set << n.eval_func(str, ta && ta.to_poly) do |f| f.exp { poly_exp } collected_node_refs.each_with_index.map do |_, i| f.param("__node_ref_#{i}") end end next if init_exp.nil? dest_set << n.init_func(str + '#init', ta && ta.to_poly) do |f| f.exp { init_exp.alpha_convert({}, (0..1000).to_a).to_poly } end end end |