lib/openwfe/expressions/fe_define.rb in openwferu-0.9.13 vs lib/openwfe/expressions/fe_define.rb in openwferu-0.9.14

- old
+ new

@@ -27,10 +27,11 @@ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. #++ +# # # "made in Japan" # # John Mettraux at openwfe.org @@ -59,12 +60,14 @@ # simply return the body fei. # def evaluate (workitem) @eval_only = true + apply workitem - return @body_fei + + @body_fei end # # Called at the end of the 'evaluation', the 'apply' operation on # the body of the definition is done here. @@ -82,9 +85,31 @@ @body_fei = nil store_itself() get_expression_pool.apply fei, workitem + end + + # + # Overrides the set_variable in FlowExpression to + # make sure to intercept requests for binding subprocesses + # at the engine level and to store a copy of the raw expression, + # not only the flow expression id. + # + def set_variable (name, fei) + + if name[0, 2] == "//" + + raw_exp = get_expression_pool.fetch_expression(fei).dup + raw_exp.parent_id = nil + raw_exp.fei = raw_exp.fei.dup + fei = raw_exp.fei + fei.wfid = get_wfid_generator.generate + + raw_exp.store_itself + end + + super name, fei end protected def get_to_next_child