private bool TryGetPreviousLocalId(SyntaxNode currentDeclarator, LocalDebugId currentId, out LocalDebugId previousId)
        {
            if (_syntaxMapOpt == null)
            {
                // no syntax map
                // => the source of the current method is the same as the source of the previous method
                // => relative positions are the same
                // => synthesized ids are the same
                previousId = currentId;
                return(true);
            }

            SyntaxNode previousDeclarator = _syntaxMapOpt(currentDeclarator);

            if (previousDeclarator == null)
            {
                previousId = default(LocalDebugId);
                return(false);
            }

            int syntaxOffset = _previousMethod.CalculateLocalSyntaxOffset(previousDeclarator.SpanStart, previousDeclarator.SyntaxTree);

            previousId = new LocalDebugId(syntaxOffset, currentId.Ordinal);
            return(true);
        }
 private int CalculateSyntaxOffsetInPreviousMethod(SyntaxNode node)
 {
     // Note that syntax offset of a syntax node contained in a lambda body is calculated by the containing top-level method,
     // not by the lambda method. The offset is thus relative to the top-level method body start. We can thus avoid mapping
     // the current lambda symbol or body to the corresponding previous lambda symbol or body, which is non-trivial.
     return(_previousTopLevelMethod.CalculateLocalSyntaxOffset(_lambdaSyntaxFacts.GetDeclaratorPosition(node), node.SyntaxTree));
 }