MsgPack.SubtreeUnpacker.DiscardCompletedStacks C# (CSharp) Method

DiscardCompletedStacks() private method

private DiscardCompletedStacks ( ) : void
return void
		private void DiscardCompletedStacks()
		{
			if ( this._itemsCount.Count == 0 )
			{
#if DEBUG
				Contract.Assert( this._unpacked.Count == 0, "this._unpacked.Count == 0" );
#endif // DEBUG
				return;
			}

			while ( this._unpacked.Peek() == this._itemsCount.Peek() )
			{
				this._itemsCount.Pop();
				this._unpacked.Pop();
				this._isMap.Pop();

				if ( this._itemsCount.Count == 0 )
				{
#if DEBUG
					Contract.Assert( this._unpacked.Count == 0, "this._unpacked.Count == 0 " );
#endif // DEBUG
					break;
				}

				this._unpacked.Push( this._unpacked.Pop() + 1 );
			}
		}