Class: SFRP::Poly::DSL::NodeProxy
- Inherits:
-
Object
- Object
- SFRP::Poly::DSL::NodeProxy
- Defined in:
- lib/sfrp/poly/dsl.rb
Instance Method Summary collapse
- #c(node_str) ⇒ Object
- #dep(node_str, last) ⇒ Object
- #eval_func(func_str, ret_type_annot = nil, &block) ⇒ Object
- #eval_func_str(func_str) ⇒ Object
- #init_func(func_str, ret_type_annot = nil, &block) ⇒ Object
- #init_func_str(func_str) ⇒ Object
-
#initialize(node_str, type_annot) ⇒ NodeProxy
constructor
A new instance of NodeProxy.
- #l(node_str) ⇒ Object
- #to_node ⇒ Object
Constructor Details
#initialize(node_str, type_annot) ⇒ NodeProxy
Returns a new instance of NodeProxy.
111 112 113 114 115 116 |
# File 'lib/sfrp/poly/dsl.rb', line 111 def initialize(node_str, type_annot) @node_str = node_str @type_annot = type_annot || TypeAnnotationVar.new('%a0') @node_refs = [] @type_annots = [] end |
Instance Method Details
#c(node_str) ⇒ Object
118 119 120 |
# File 'lib/sfrp/poly/dsl.rb', line 118 def c(node_str) dep(node_str, false) end |
#dep(node_str, last) ⇒ Object
126 127 128 129 |
# File 'lib/sfrp/poly/dsl.rb', line 126 def dep(node_str, last) @node_refs << Node::NodeRef.new(node_str, last) @type_annots << TypeAnnotationVar.new('%a' + @node_refs.size.to_s) end |
#eval_func(func_str, ret_type_annot = nil, &block) ⇒ Object
131 132 133 134 |
# File 'lib/sfrp/poly/dsl.rb', line 131 def eval_func(func_str, ret_type_annot = nil, &block) @eval_func_str = func_str DSL.func(func_str, ret_type_annot, &block) end |
#eval_func_str(func_str) ⇒ Object
141 142 143 |
# File 'lib/sfrp/poly/dsl.rb', line 141 def eval_func_str(func_str) @eval_func_str = func_str end |
#init_func(func_str, ret_type_annot = nil, &block) ⇒ Object
136 137 138 139 |
# File 'lib/sfrp/poly/dsl.rb', line 136 def init_func(func_str, ret_type_annot = nil, &block) @init_func_str = func_str DSL.func(func_str, ret_type_annot, &block) end |
#init_func_str(func_str) ⇒ Object
145 146 147 |
# File 'lib/sfrp/poly/dsl.rb', line 145 def init_func_str(func_str) @init_func_str = func_str end |
#l(node_str) ⇒ Object
122 123 124 |
# File 'lib/sfrp/poly/dsl.rb', line 122 def l(node_str) dep(node_str, true) end |
#to_node ⇒ Object
149 150 151 152 153 |
# File 'lib/sfrp/poly/dsl.rb', line 149 def to_node a = @node_refs.size.times.map { |i| TypeAnnotationVar.new("a#{i}") } annot = FuncTypeAnnotation.new(@type_annot, a) Node.new(@node_str, @node_refs, annot, @eval_func_str, @init_func_str) end |