/// <summary> /// Convert a `Value` on the stack into another type (bypassing type checking) /// </summary> private void StaticUnbox(StackType to) { switch (to) { default: throw new ArgumentOutOfRangeException(nameof(to), $"Cannot unbox to {to}"); case StackType.YololValue: return; case StackType.YololNumber: // If this is a release build directly access the underlying field value, avoiding the dynamic type check. If it's // a debug build load it through the property (which will throw if type annotations are wrong). #if RELEASE _emitter.GetRuntimeFieldValue <TEmit, Value>("_number"); #else _emitter.GetRuntimePropertyValue <TEmit, Value>(nameof(Value.Number)); #endif return; case StackType.YololString: // If this is a release build directly access the underlying field value, avoiding the dynamic type check. If it's // a debug build load it through the property (which will throw if type annotations are wrong). #if RELEASE _emitter.GetRuntimeFieldValue <TEmit, Value>("_string"); #else _emitter.GetRuntimePropertyValue <TEmit, Value>(nameof(Value.String)); #endif return; case StackType.Bool: _emitter.EmitCoerce(StackType.YololValue, StackType.Bool); return; } }