// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.JavaScript
{
public partial struct JSMarshalerArgument
{
/// <summary>
/// Implementation of the argument marshaling.
/// It's used by JSImport code generator and should not be used by developers in source code.
/// </summary>
/// <param name="value">The value to be marshaled.</param>
#if !DEBUG
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public void ToManagedBig(out long value)
{
if (slot.Type == MarshalerType.None)
{
value = default;
return;
}
value = slot.Int64Value;
}
/// <summary>
/// Implementation of the argument marshaling.
/// It's used by JSImport code generator and should not be used by developers in source code.
/// </summary>
/// <param name="value">The value to be marshaled.</param>
#if !DEBUG
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public void ToJSBig(long value)
{
slot.Type = MarshalerType.BigInt64;
slot.Int64Value = value;
}
/// <summary>
/// Implementation of the argument marshaling.
/// It's used by JSImport code generator and should not be used by developers in source code.
/// </summary>
/// <param name="value">The value to be marshaled.</param>
#if !DEBUG
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public void ToManagedBig(out long? value)
{
if (slot.Type == MarshalerType.None)
{
value = null;
return;
}
value = slot.Int64Value;
}
/// <summary>
/// Implementation of the argument marshaling.
/// It's used by JSImport code generator and should not be used by developers in source code.
/// </summary>
/// <param name="value">The value to be marshaled.</param>
#if !DEBUG
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public void ToJSBig(long? value)
{
if (value.HasValue)
{
slot.Type = MarshalerType.BigInt64;
slot.Int64Value = value.Value;
}
else
{
slot.Type = MarshalerType.None;
}
}
}
}
|