protected override void VisitMethodBody(MethodBodyNode node) { foreach (var line in node.Lines) { AppendLine(line); } }
protected override void VisitMethodBody(MethodBodyNode node) { if (node == null) { return; } foreach (var line in node.Lines) { AppendLine(line); } }
private void AddAsyncStateLinks(string memberName, TypeDefinition asyncType) { // Try to get the "MovNext method with contains the actual "async/await" code MethodDefinition moveNextMethod = asyncType.Methods .FirstOrDefault(method => method.Name == "MoveNext"); if (moveNextMethod != null) { MethodBodyNode methodBodyNode = new MethodBodyNode(memberName, moveNextMethod, true); AddMethodBodyLinks(methodBodyNode); } }
private void AddMethodBodyLinks(MethodBodyNode methodBodyNode) { try { string memberName = methodBodyNode.MemberName; MethodDefinition method = methodBodyNode.Method; if (method.DeclaringType.IsInterface || !method.HasBody) { return; } MethodBody body = method.Body; body.Variables.ForEach(variable => AddLinkToMethodVariable(memberName, variable, methodBodyNode.IsMoveNext)); foreach (Instruction instruction in body.Instructions) { IlCount++; if (instruction.Operand is MethodReference methodCall) { AddLinkToCallMethod(memberName, methodCall); } else if (instruction.Operand is FieldDefinition field) { linkHandler.AddLinkToType(memberName, field.FieldType); linkHandler.AddLinkToMember(memberName, field); } } } catch (Exception e) { Log.Exception(e); } }
protected virtual void VisitMethodBody(MethodBodyNode node) { }