Esempio n. 1
0
        /// <summary>
        /// Generates the code for a FunctionCall node.
        /// </summary>
        /// <param name="fc">The FunctionCall node.</param>
        /// <returns>String containing C# code for FunctionCall fc.</returns>
        private void GenerateFunctionCall(FunctionCall fc, StringBuilder sb)
        {
            string modinvoke = null;

            if (m_comms != null)
            {
                modinvoke = m_comms.LookupModInvocation(fc.Id);
            }

            if (modinvoke != null)
            {
                if (fc.kids[0] is ArgumentList)
                {
                    if ((fc.kids[0] as ArgumentList).kids.Count == 0)
                    {
                        Generate(String.Format("{0}(\"{1}\"", modinvoke, fc.Id), fc, sb);
                    }
                    else
                    {
                        Generate(String.Format("{0}(\"{1}\",", modinvoke, fc.Id), fc, sb);
                    }
                }
            }
            else
            {
                Generate(String.Format("{0}(", CheckName(fc.Id)), fc, sb);
            }

            foreach (SYMBOL kid in fc.kids)
            {
                GenerateNodeToSB(fc, kid, sb);
            }

            Generate(")", sb);
        }
Esempio n. 2
0
        /// <summary>
        /// Generates the code for a FunctionCall node.
        /// </summary>
        /// <param name="fc">The FunctionCall node.</param>
        /// <returns>String containing C# code for FunctionCall fc.</returns>
        private string GenerateFunctionCall(FunctionCall fc)
        {
            string retstr = String.Empty;

            string modinvoke = null;

            if (m_comms != null)
            {
                modinvoke = m_comms.LookupModInvocation(fc.Id);
            }

            if (modinvoke != null)
            {
                if (fc.kids[0] is ArgumentList)
                {
                    if ((fc.kids[0] as ArgumentList).kids.Count == 0)
                    {
                        retstr += Generate(String.Format("{0}(\"{1}\"", modinvoke, fc.Id), fc);
                    }
                    else
                    {
                        retstr += Generate(String.Format("{0}(\"{1}\",", modinvoke, fc.Id), fc);
                    }
                }
            }
            else
            {
                retstr += Generate(String.Format("{0}(", CheckName(fc.Id)), fc);
            }

            foreach (SYMBOL kid in fc.kids)
            {
                retstr += GenerateNode(kid);
            }

            retstr += Generate(")");

            return(retstr);
        }