static private IsCalculated ( |
||
unparsableAst | ||
return | bool |
/// <exception cref="UnparsableAst.NonCalculatedException"> /// If topLeft is non-calculated. /// </exception> private static UnparsableAst GetLeftTerminalLeave(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 leftTerminalLeave; if (formatYielder == null || !UnparsableAst.IsCalculated(formatYielder.topAncestorCacheForLeft)) { leftTerminalLeave = CalculateLeftTerminalLeave(self, formatYielder); if (formatYielder != null) { formatYielder.leftTerminalLeaveCache = leftTerminalLeave; } } else { leftTerminalLeave = formatYielder.leftTerminalLeaveCache; //Unparser.tsUnparse.Debug(formatter.leftTerminalLeaveCache != CalculateLeftTerminalLeave(self, formatter), // "!!!!!!!! should be equal for {0}, but leftTerminalLeaveCache is '{1}' and calculated value is '{2}'", self, formatter.leftTerminalLeaveCache, CalculateLeftTerminalLeave(self, formatter)); Debug.Assert(formatYielder.leftTerminalLeaveCache == CalculateLeftTerminalLeave(self, formatYielder)); } return(leftTerminalLeave); }
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); }