public void EnsureStack() {
switch (this.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
this.helper.LoadQueryRuntime();
this.helper.Call(this.storage.GlobalLocation);
break;
default:
Debug.Assert(false, "Invalid location: " + this.storage.Location);
break;
}
this.storage = this.storage.ToStack();
}