Skip to content

Commit

Permalink
Rename DataViewInstance to JsDataView (#1593)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma authored Jul 28, 2023
1 parent b48e7b7 commit 0163e1a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
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)
{
}
}

0 comments on commit 0163e1a

Please sign in to comment.