private ISourceMethod GetSourceMethod(IModule module, string parentType, string name, out string localName) { localName = name; string sourceParentType = parentType; int parentTypeLastSeparator = parentType.LastIndexOfAny(cTypeNameSeparators); if (parentTypeLastSeparator >= 0) { string typeSimpleName = parentType.Substring(parentTypeLastSeparator + 1); if (GeneratedNames.TryParseGeneratedName(typeSimpleName, out var genTypeNameKind, out _, out _)) { sourceParentType = parentType.Remove(parentTypeLastSeparator); // lambda display class names don't contain the method - need to parse the method name below if (genTypeNameKind == StateMachineType) { if (GeneratedNames.TryParseSourceMethodNameFromGeneratedName(typeSimpleName, genTypeNameKind, out string sourceMethodName)) { var sourceMethod = GetSourceMethod(module, sourceParentType, sourceMethodName, out localName); localName += " [state machine]"; return(sourceMethod); } } } } if (GeneratedNames.TryParseGeneratedName(name, out var genMethodNameKind, out _, out _)) { if (GeneratedNames.TryParseSourceMethodNameFromGeneratedName(name, genMethodNameKind, out string sourceMethodName)) { var sourceMethod = GetSourceMethod(module, sourceParentType, sourceMethodName, out localName); switch (genMethodNameKind) { case IteratorFinallyMethod: localName += " [iterator finally]"; break; case LambdaMethod: localName += " [lambda]"; break; case LocalFunction: if (GeneratedNames.TryParseLocalFunctionNameFromGeneratedName(name, out string localFunctionName)) { localName += "." + localFunctionName; } break; } return(sourceMethod); } } return(new SourceMethod(module, parentType, name)); }