/// <summary>
/// Ensure that the current item is pushed onto the stack.
/// </summary>
public void EnsureStack()
{
switch (_storage.Location)
{
case ItemLocation.Stack:
// Already on the stack
return;
case ItemLocation.Parameter:
case ItemLocation.Local:
case ItemLocation.Current:
PushValue();
break;
case ItemLocation.Global:
// Call method that computes the value of this global value
_helper.LoadQueryRuntime();
_helper.Call(_storage.GlobalLocation);
break;
default:
Debug.Assert(false, "Invalid location: " + _storage.Location);
break;
}
_storage = _storage.ToStack();
}