public IWorkshopTree Call() { // Call subroutine. if (Determiner.IsSubroutine()) { var subroutineInfo = Determiner.GetSubroutineInfo(); SetSubroutineParameters(subroutineInfo); // Store the object the subroutine is executing with. if (Determiner.IsObject()) { // Normal if (!Determiner.IsRecursive()) { ActionSet.AddAction(subroutineInfo.ObjectStore.SetVariable((Element)ActionSet.CurrentObject)); } // Recursive: Stack else { ActionSet.AddAction(subroutineInfo.ObjectStore.ModifyVariable(Operation.AppendToArray, Element.CreateArray(ActionSet.CurrentObject))); } } ExecuteSubroutine(subroutineInfo.Subroutine, CallHandler.ParallelMode); return(subroutineInfo.ReturnHandler.GetReturnedValue()); } // Inline function else { // Recursive stack. if (Determiner.IsRecursive()) { var lastCall = Determiner.GetExistingRecursiveStack(ActionSet.Translate.MethodStack); // Function is not yet on the stack. if (lastCall == null) { return(Build()); } else // Recursive call. { lastCall.RecursiveCall(CallHandler, ActionSet); return(ActionSet.ReturnHandler.GetReturnedValue()); } } else { return(Build()); } } }