Skip to content

Commit

Permalink
Rename WeakSetInstance to JsWeakSet (#1598)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma authored Jul 30, 2023
1 parent 2ec677c commit 805ae4f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Jint.Tests/Runtime/WeakSetMapTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void WeakSetShouldThrowWhenCalledWithoutNew()
public void WeakSetAddShouldThrowForPrimitiveKey(JsValue key)
{
var engine = new Engine();
var weakSet = new WeakSetInstance(engine);
var weakSet = new JsWeakSet(engine);

var e = Assert.Throws<JavaScriptException>(() => weakSet.WeakSetAdd(key));
Assert.StartsWith("WeakSet value must be an object or symbol, got ", e.Message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

namespace Jint.Native.WeakSet;

internal sealed class WeakSetInstance : ObjectInstance
internal sealed class JsWeakSet : ObjectInstance
{
private readonly ConditionalWeakTable<JsValue, JsValue> _table;

public WeakSetInstance(Engine engine) : base(engine)
public JsWeakSet(Engine engine) : base(engine)
{
_table = new ConditionalWeakTable<JsValue, JsValue>();
}
Expand Down
2 changes: 1 addition & 1 deletion Jint/Native/WeakSet/WeakSetConstructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget)
var set = OrdinaryCreateFromConstructor(
newTarget,
static intrinsics => intrinsics.WeakSet.PrototypeObject,
static (Engine engine, Realm _, object? _) => new WeakSetInstance(engine));
static (Engine engine, Realm _, object? _) => new JsWeakSet(engine));

var arg1 = arguments.At(0);
if (!arg1.IsNullOrUndefined())
Expand Down
4 changes: 2 additions & 2 deletions Jint/Native/WeakSet/WeakSetPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ private JsValue Has(JsValue thisObject, JsValue[] arguments)
return set.WeakSetHas(arguments.At(0)) ? JsBoolean.True : JsBoolean.False;
}

private WeakSetInstance AssertWeakSetInstance(JsValue thisObject)
private JsWeakSet AssertWeakSetInstance(JsValue thisObject)
{
if (thisObject is WeakSetInstance set)
if (thisObject is JsWeakSet set)
{
return set;
}
Expand Down

0 comments on commit 805ae4f

Please sign in to comment.