// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.ClearScript.V8
{
///
/// Represents a compiled script that can be executed multiple times without recompilation.
///
public abstract class V8Script : IDisposable
{
internal V8Script(UniqueDocumentInfo documentInfo, UIntPtr codeDigest)
{
UniqueDocumentInfo = documentInfo;
CodeDigest = codeDigest;
}
///
/// Gets the document name associated with the compiled script.
///
[Obsolete("Use DocumentInfo instead.")]
public string Name => UniqueDocumentInfo.UniqueName;
///
/// Gets the document meta-information for the compiled script.
///
public DocumentInfo DocumentInfo => UniqueDocumentInfo.Info;
internal UniqueDocumentInfo UniqueDocumentInfo { get; }
internal UIntPtr CodeDigest { get; }
#region IDisposable implementation (abstract)
///
/// Releases all resources used by the compiled script.
///
///
/// Call Dispose() when you are finished using the compiled script. Dispose()
/// leaves the compiled script in an unusable state. After calling Dispose(), you
/// must release all references to the compiled script so the garbage collector can reclaim
/// the memory that the compiled script was occupying.
///
[SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "This class is almost purely abstract; the implementation class implements disposal.")]
public abstract void Dispose();
#endregion
}
}