示例#1
0
        public void LogWarning(string text, int code, MethodIL origin, int ilOffset, string subcategory = MessageSubCategory.None)
        {
            string document   = null;
            int?   lineNumber = null;

            IEnumerable <ILSequencePoint> sequencePoints = origin.GetDebugInfo()?.GetSequencePoints();

            if (sequencePoints != null)
            {
                foreach (var sequencePoint in sequencePoints)
                {
                    if (sequencePoint.Offset <= ilOffset)
                    {
                        document   = sequencePoint.Document;
                        lineNumber = sequencePoint.LineNumber;
                    }
                }
            }

            MethodDesc warnedMethod = CompilerGeneratedState.GetUserDefinedMethodForCompilerGeneratedMember(origin.OwningMethod) ?? origin.OwningMethod;

            MessageOrigin messageOrigin = new MessageOrigin(warnedMethod, document, lineNumber, null);

            LogWarning(text, code, messageOrigin, subcategory);
        }
示例#2
0
        public void LogWarning(MethodIL origin, int ilOffset, DiagnosticId id, params string[] args)
        {
            string document   = null;
            int?   lineNumber = null;

            IEnumerable <ILSequencePoint> sequencePoints = origin.GetDebugInfo()?.GetSequencePoints();

            if (sequencePoints != null)
            {
                foreach (var sequencePoint in sequencePoints)
                {
                    if (sequencePoint.Offset <= ilOffset)
                    {
                        document   = sequencePoint.Document;
                        lineNumber = sequencePoint.LineNumber;
                    }
                }
            }

            MethodDesc warnedMethod = CompilerGeneratedState.GetUserDefinedMethodForCompilerGeneratedMember(origin.OwningMethod) ?? origin.OwningMethod;

            MessageOrigin messageOrigin = new MessageOrigin(warnedMethod, document, lineNumber, null);

            LogWarning(messageOrigin, id, args);
        }
示例#3
0
文件: Logger.cs 项目: dotnet/runtime
        public void LogWarning(string text, int code, MethodIL origin, int ilOffset, string subcategory = MessageSubCategory.None)
        {
            MessageOrigin messageOrigin = new MessageOrigin(origin, ilOffset);

            LogWarning(text, code, messageOrigin, subcategory);
        }
示例#4
0
文件: Logger.cs 项目: dotnet/runtime
        public void LogWarning(MethodIL origin, int ilOffset, DiagnosticId id, params string[] args)
        {
            MessageOrigin messageOrigin = new MessageOrigin(origin, ilOffset);

            LogWarning(messageOrigin, id, args);
        }
示例#5
0
 public virtual void GetDependenciesDueToAccess(ref DependencyList dependencies, NodeFactory factory, MethodIL methodIL, FieldDesc writtenField)
 {
 }
示例#6
0
 public virtual void GetDependenciesDueToAccess(ref DependencyList dependencies, NodeFactory factory, MethodIL methodIL, MethodDesc calledMethod)
 {
 }
示例#7
0
 protected virtual void GetDependenciesDueToMethodCodePresenceInternal(ref DependencyList dependencies, NodeFactory factory, MethodDesc method, MethodIL methodIL)
 {
     // MetadataManagers can override this to provide additional dependencies caused by the presence of a
     // compiled method body.
 }
示例#8
0
        /// <summary>
        /// This method is an extension point that can provide additional metadata-based dependencies to generated method bodies.
        /// </summary>
        public void GetDependenciesDueToMethodCodePresence(ref DependencyList dependencies, NodeFactory factory, MethodDesc method, MethodIL methodIL)
        {
            if (method.HasInstantiation)
            {
                ExactMethodInstantiationsNode.GetExactMethodInstantiationDependenciesForMethod(ref dependencies, factory, method);
            }

            GetDependenciesDueToMethodCodePresenceInternal(ref dependencies, factory, method, methodIL);
        }