Skip to content

Commit

Permalink
Don't require Realm in Constructor public constructor (#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed Feb 18, 2023
1 parent 5eb6b82 commit fedd680
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Jint.Tests.PublicInterface/ConstructorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void CanThrowTypeError()

file sealed class DateOnlyConstructor : Constructor
{
public DateOnlyConstructor(Engine engine) : base(engine, engine.Realm, (JsString) "DateOnly")
public DateOnlyConstructor(Engine engine) : base(engine, "DateOnly")
{
}

Expand Down
6 changes: 5 additions & 1 deletion Jint/Native/Constructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ namespace Jint.Native;

public abstract class Constructor : FunctionInstance, IConstructor
{
protected Constructor(Engine engine, Realm realm, JsString name) : base(engine, realm, name)
protected Constructor(Engine engine, string name) : this(engine, engine.Realm, new JsString(name))
{
}

internal Constructor(Engine engine, Realm realm, JsString name) : base(engine, realm, name)
{
}

Expand Down

0 comments on commit fedd680

Please sign in to comment.