Warning() private method

private Warning ( TraceSwitch traceSwitch, string message ) : void
traceSwitch TraceSwitch
message string
return void
Beispiel #1
0
        internal static string TypeNameMangleImpl(Dictionary <string, TypeWrapper> dict, string name, TypeWrapper tw)
        {
            // the CLR maximum type name length is 1023 characters,
            // but we need to leave some room for the suffix that we
            // may need to append to make the name unique
            const int MaxLength = 1000;

            if (name.Length > MaxLength)
            {
                name = name.Substring(0, MaxLength) + "/truncated";
            }
            string mangledTypeName = TypeNameUtil.ReplaceIllegalCharacters(name);

            // FXBUG the CLR (both 1.1 and 2.0) doesn't like type names that end with a single period,
            // it loses the trailing period in the name that gets passed in the TypeResolve event.
            if (dict.ContainsKey(mangledTypeName) || mangledTypeName.EndsWith("."))
            {
#if STATIC_COMPILER
                Tracer.Warning(Tracer.Compiler, "Class name clash: {0}", mangledTypeName);
#endif
                // Java class names cannot contain slashes (since they are converted into periods),
                // so we take advantage of that fact to create a unique name.
                string baseName   = mangledTypeName;
                int    instanceId = 0;
                do
                {
                    mangledTypeName = baseName + "/" + (++instanceId);
                } while (dict.ContainsKey(mangledTypeName));
            }
            dict.Add(mangledTypeName, tw);
            return(mangledTypeName);
        }
Beispiel #2
0
        public static bool IsTracedMethod(string name)
        {
            if (methodtraces.Count == 0)
            {
                return(false);
            }
            IEnumerator <string> e = methodtraces.GetEnumerator();

            while (e.MoveNext())
            {
                try
                {
                    if (Regex.IsMatch(name, e.Current))
                    {
                        return(true);
                    }
                }
                catch (Exception x)
                {
                    Tracer.Warning(Tracer.Compiler, "Regular Expression match failure: " + e.Current + ":" + x);
                }
            }
            return(false);
        }