Пример #1
0
        /// <summary>
        /// Determine if the method appears to have some implementation.
        /// </summary>
        /// <param name="mth"></param>
        /// <returns></returns>
        public static bool HasImplementation(Method mth)
        {
            if (mth == null)
            {
                return(false);
            }
            if (String.IsNullOrWhiteSpace(mth.Source))
            {
                return(false);
            }
            var parser = new Compiler.SemanticAnalysis.Parser();

            try
            {
                var method = parser.ParseMethod(new System.IO.StringReader(mth.Source));
                if (method == null)
                {
                    return(false);
                }
                return(!((method.Statements == null) && (method.Primitive == null) && (method.Temporaries.Count == 0)));
            }
            catch
            {
                return(false);
            }
        }
Пример #2
0
 /// <summary>
 /// Determine if the method appears to have some implementation.
 /// </summary>
 /// <param name="mth"></param>
 /// <returns></returns>
 public static bool HasImplementation(Method mth)
 {
     if (mth == null)
         return false;
     if (String.IsNullOrWhiteSpace(mth.Source))
         return false;
     var parser = new Compiler.SemanticAnalysis.Parser();
     try
     {
         var method = parser.ParseMethod(new System.IO.StringReader(mth.Source));
         if (method == null)
             return false;
         return !((method.Statements == null) && (method.Primitive == null) && (method.Temporaries.Count == 0));
     }
     catch
     {
         return false;
     }
 }