Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename DataViewInstance to JsDataView #1593

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected override void Initialize()
private static JsValue IsView(JsValue thisObject, JsValue[] arguments)
{
var arg = arguments.At(0);
return arg is DataViewInstance or JsTypedArray;
return arg is JsDataView or JsTypedArray;
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Jint/Native/DataView/DataViewConstructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal DataViewConstructor(
_prototypeDescriptor = new PropertyDescriptor(PrototypeObject, PropertyFlag.AllForbidden);
}

public DataViewPrototype PrototypeObject { get; }
private DataViewPrototype PrototypeObject { get; }

public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget)
{
Expand Down Expand Up @@ -74,7 +74,7 @@ public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget)
var o = OrdinaryCreateFromConstructor(
newTarget,
static intrinsics => intrinsics.DataView.PrototypeObject,
static (Engine engine, Realm _, object? _) => new DataViewInstance(engine));
static (Engine engine, Realm _, object? _) => new JsDataView(engine));

if (buffer.IsDetachedBuffer)
{
Expand Down
10 changes: 5 additions & 5 deletions Jint/Native/DataView/DataViewPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected override void Initialize()
/// </summary>
private JsValue Buffer(JsValue thisObj, JsValue[] arguments)
{
var o = thisObj as DataViewInstance;
var o = thisObj as JsDataView;
if (o is null)
{
ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.buffer called on incompatible receiver " + thisObj);
Expand All @@ -84,7 +84,7 @@ private JsValue Buffer(JsValue thisObj, JsValue[] arguments)
/// </summary>
private JsValue ByteLength(JsValue thisObj, JsValue[] arguments)
{
var o = thisObj as DataViewInstance;
var o = thisObj as JsDataView;
if (o is null)
{
ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.byteLength called on incompatible receiver " + thisObj);
Expand All @@ -101,7 +101,7 @@ private JsValue ByteLength(JsValue thisObj, JsValue[] arguments)
/// </summary>
private JsValue ByteOffset(JsValue thisObj, JsValue[] arguments)
{
var o = thisObj as DataViewInstance;
var o = thisObj as JsDataView;
if (o is null)
{
ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.byteOffset called on incompatible receiver " + thisObj);
Expand Down Expand Up @@ -222,7 +222,7 @@ private JsValue GetViewValue(
JsValue isLittleEndian,
TypedArrayElementType type)
{
var dataView = view as DataViewInstance;
var dataView = view as JsDataView;
if (dataView is null)
{
ExceptionHelper.ThrowTypeError(_realm, "Method called on incompatible receiver " + view);
Expand Down Expand Up @@ -256,7 +256,7 @@ private JsValue SetViewValue(
TypedArrayElementType type,
JsValue value)
{
var dataView = view as DataViewInstance;
var dataView = view as JsDataView;
if (dataView is null)
{
ExceptionHelper.ThrowTypeError(_realm, "Method called on incompatible receiver " + view);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ namespace Jint.Native.DataView;
/// <summary>
/// https://tc39.es/ecma262/#sec-properties-of-dataview-instances
/// </summary>
internal sealed class DataViewInstance : ObjectInstance
internal sealed class JsDataView : ObjectInstance
{
internal JsArrayBuffer? _viewedArrayBuffer;
internal uint _byteLength;
internal uint _byteOffset;

internal DataViewInstance(Engine engine) : base(engine)
internal JsDataView(Engine engine) : base(engine)
{
}
}