Пример #1
0
        private void TryInsertReportMethodArguments(ILProcessor il, Instruction instruction, MethodDefinition method, ReportMethods flow, IWorkSession session, ref int index)
        {
            if (!method.HasParameters)
            {
                return;
            }

            var sequencePoint  = instruction.SequencePoint;
            var parameterLines = _languages[session.LanguageName]
                                 .GetMethodParameterLines(session, sequencePoint.StartLine, sequencePoint.StartColumn);

            if (parameterLines.Length == 0)
            {
                return;
            }

            foreach (var parameter in method.Parameters)
            {
                if (parameter.ParameterType.IsByReference)
                {
                    continue;
                }
                InsertReportValue(
                    il, instruction,
                    il.CreateLdargBest(parameter), parameter.ParameterType, parameter.Name,
                    parameterLines[parameter.Index], flow,
                    ref index
                    );
            }
        }
Пример #2
0
        private void TryInsertReportMethodArguments(ILProcessor il, Instruction instruction, SequencePoint sequencePoint, MethodDefinition method, ReportMethods flow, IWorkSession session, ref int index)
        {
            if (!method.HasParameters)
            {
                return;
            }

            var parameterLines = _languages[session.LanguageName]
                                 .GetMethodParameterLines(session, sequencePoint.StartLine, sequencePoint.StartColumn);

            if (parameterLines.Length == 0)
            {
                return;
            }

            // Note: method parameter lines are unreliable and can potentially return
            // wrong lines if nested method syntax is unrecognized and code matches it
            // to the containing method. That is acceptable, as long as parameter count
            // mismatch does not crash things -> so check length here.
            if (parameterLines.Length != method.Parameters.Count)
            {
                return;
            }

            foreach (var parameter in method.Parameters)
            {
                if (parameter.IsOut)
                {
                    continue;
                }

                InsertReportValue(
                    il, instruction,
                    il.CreateLdargBest(parameter), parameter.ParameterType, parameter.Name,
                    parameterLines[parameter.Index], flow,
                    ref index
                    );
            }
        }