Example #1
0
        /// <summary>
        /// Joins every user-defined function to the end of the command list.
        /// After calling this function you should NOT change the command list.
        /// </summary>
        public void JoinCommands()
        {
            if (!isJoined)
            {
                originalCommandList = CommandList;
                CommandList = new CommandList();
                CommandList.AddRange(originalCommandList);
                if (CommandList.Count > 0 && !(CommandList.Last() is Return))
                {
                    CommandList.Add(new Return(false));
                }
                //EntryPoints.Clear();
                foreach (var udf in Functions)
                {
                    //EntryPoints.Add(udf, CommandList.Count);
                    udf.EntryPoint = CommandList.Count;
                    CommandList.AddRange(udf.Commands);
                }

                isJoined = true;
            }
        }