#if UNITY_EDITOR
using System;
using UnityEditor;
namespace Unity.Burst.Editor
{
///
/// Provides helper methods that can be used in the Editor.
///
internal static class BurstEditorUtility
{
#if UNITY_2020_1_OR_NEWER
///
/// Requests previously-compiled functions to be cleared from the cache during the next domain reload.
/// Note that this method does not trigger a domain reload itself, so it should be paired with
/// to force a domain reload.
///
///
/// During the next domain reload, previously-compiled functions are unloaded from memory,
/// and the corresponding libraries in the on-disk cache are deleted.
///
/// This method cannot be called while the Editor is in play mode.
///
///
/// The following example shows calling this method in a test, then triggering a domain reload,
/// and then waiting for the domain reload to finish:
///
/// BurstEditorUtility.RequestClearJitCache();
/// EditorUtility.RequestScriptReload();
/// yield return new WaitForDomainReload();
///
///
public static void RequestClearJitCache()
{
if (EditorApplication.isPlayingOrWillChangePlaymode)
{
throw new InvalidOperationException("This method cannot be called while the Editor is in play mode");
}
BurstCompiler.RequestClearJitCache();
}
#endif
}
}
#endif