コード例 #1
0
        private string GetTypeString(ITree parameterType)
        {
            if (parameterType != null && parameterType.Type == GoLexer.ELLIP && parameterType.ChildCount == 1)
            {
                return("..." + GetTypeString(parameterType.GetChild(0)));
            }

            return(GoTypeFormatter.FormatType(parameterType));
        }
コード例 #2
0
        public static string FormatType(ITree typeTree)
        {
            if (typeTree == null)
            {
                return("<null>");
            }

            try
            {
                CommonTreeNodeStream input     = new CommonTreeNodeStream(typeTree);
                GoTypeFormatter      formatter = new GoTypeFormatter(input);
                return(formatter.type());
            }
            catch (Exception e) when(!ErrorHandler.IsCriticalException(e))
            {
                return("?");
            }
        }
コード例 #3
0
        public static string FormatType(ITree typeTree)
        {
            if (typeTree == null)
                return "<null>";

            try
            {
                CommonTreeNodeStream input = new CommonTreeNodeStream(typeTree);
                GoTypeFormatter formatter = new GoTypeFormatter(input);
                return formatter.type();
            }
            catch (Exception e)
            {
                if (ErrorHandler.IsCriticalException(e))
                    throw;

                return "?";
            }
        }