Sarcasm.Unparsing.FormatYielder.GetTopAncestorForLeft C# (CSharp) Méthode

GetTopAncestorForLeft() private static méthode

private static GetTopAncestorForLeft ( UnparsableAst self, FormatYielder formatYielder = null ) : UnparsableAst
self UnparsableAst
formatYielder FormatYielder
Résultat UnparsableAst
        private static UnparsableAst GetTopAncestorForLeft(UnparsableAst self, FormatYielder formatYielder = null)
        {
            // NOTE: topAncestorCacheForLeft will not be changed if we have no formatter, that's why we use topAncestorForLeft + the static vs. instance behavior
            UnparsableAst topAncestorForLeft;

            if (formatYielder == null || !UnparsableAst.IsCalculated(formatYielder.topAncestorCacheForLeft))
            {
                topAncestorForLeft = CalculateTopAncestorForLeft(self);

                if (formatYielder != null)
                    formatYielder.topAncestorCacheForLeft = topAncestorForLeft;
            }
            else
            {
                topAncestorForLeft = formatYielder.topAncestorCacheForLeft;
                //Unparser.tsUnparse.Debug(formatter.topAncestorCacheForLeft != CalculateTopAncestorForLeft(self),
                //    "!!!!!!!! should be equal for {0}, but topAncestorCacheForLeft is '{1}' and calculated value is '{2}'", self, formatter.topAncestorCacheForLeft, CalculateTopAncestorForLeft(self));
                Debug.Assert(formatYielder.topAncestorCacheForLeft == CalculateTopAncestorForLeft(self));
            }

            return topAncestorForLeft;
        }