Skip to content

Commit

Permalink
Rename WeakMapInstance to JsWeakMap (#1599)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed Jul 30, 2023
1 parent 805ae4f commit 4bff490
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 @@ -52,7 +52,7 @@ public void WeakSetAddShouldThrowForPrimitiveKey(JsValue key)
public void WeakMapSetShouldThrowForPrimitiveKey(JsValue key)
{
var engine = new Engine();
var weakMap = new WeakMapInstance(engine);
var weakMap = new JsWeakMap(engine);

var e = Assert.Throws<JavaScriptException>(() => weakMap.WeakMapSet(key, new JsObject(engine)));
Assert.StartsWith("WeakMap key must be an object, got ", e.Message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

namespace Jint.Native.WeakMap;

internal sealed class WeakMapInstance : ObjectInstance
internal sealed class JsWeakMap : ObjectInstance
{
private readonly ConditionalWeakTable<JsValue, JsValue> _table;

public WeakMapInstance(Engine engine) : base(engine)
public JsWeakMap(Engine engine) : base(engine)
{
_table = new ConditionalWeakTable<JsValue, JsValue>();
}
Expand Down
2 changes: 1 addition & 1 deletion Jint/Native/WeakMap/WeakMapConstructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget)
var map = OrdinaryCreateFromConstructor(
newTarget,
static intrinsics => intrinsics.WeakMap.PrototypeObject,
static (Engine engine, Realm _, object? _) => new WeakMapInstance(engine));
static (Engine engine, Realm _, object? _) => new JsWeakMap(engine));
if (arguments.Length > 0 && !arguments[0].IsNullOrUndefined())
{
var adder = map.Get("set");
Expand Down
4 changes: 2 additions & 2 deletions Jint/Native/WeakMap/WeakMapPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ private JsValue Has(JsValue thisObject, JsValue[] arguments)
return map.WeakMapHas(arguments.At(0)) ? JsBoolean.True : JsBoolean.False;
}

private WeakMapInstance AssertWeakMapInstance(JsValue thisObject)
private JsWeakMap AssertWeakMapInstance(JsValue thisObject)
{
if (thisObject is WeakMapInstance map)
if (thisObject is JsWeakMap map)
{
return map;
}
Expand Down

0 comments on commit 4bff490

Please sign in to comment.