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 WeakSetInstance to JsWeakSet #1598

Merged
merged 1 commit into from
Jul 30, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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