diff --git a/Jint/Native/Function/ClassDefinition.cs b/Jint/Native/Function/ClassDefinition.cs
index 6c7faf262f..c8961fc1e5 100644
--- a/Jint/Native/Function/ClassDefinition.cs
+++ b/Jint/Native/Function/ClassDefinition.cs
@@ -89,7 +89,7 @@ public JsValue BuildConstructor(EvaluationContext context, EnvironmentRecord env
}
else
{
- var temp = superclass.Get("prototype");
+ var temp = superclass.Get(CommonProperties.Prototype);
if (temp is ObjectInstance protoParentObject)
{
protoParent = protoParentObject;
diff --git a/Jint/Native/Generator/GeneratorFunctionConstructor.cs b/Jint/Native/Generator/GeneratorFunctionConstructor.cs
index 79dbbbc1ef..216dc78334 100644
--- a/Jint/Native/Generator/GeneratorFunctionConstructor.cs
+++ b/Jint/Native/Generator/GeneratorFunctionConstructor.cs
@@ -9,7 +9,7 @@ namespace Jint.Native.Generator;
///
/// https://tc39.es/ecma262/#sec-generatorfunction-constructor
///
-internal sealed class GeneratorFunctionConstructor : FunctionInstance, IConstructor
+internal sealed class GeneratorFunctionConstructor : Constructor
{
private static readonly JsString _functionName = new("GeneratorFunction");
@@ -33,7 +33,7 @@ protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments
return Construct(arguments, thisObject);
}
- public ObjectInstance Construct(JsValue[] arguments, JsValue newTarget)
+ public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget)
{
var function = _realm.Intrinsics.Function.CreateDynamicFunction(
this,
diff --git a/Jint/Native/Generator/GeneratorFunctionPrototype.cs b/Jint/Native/Generator/GeneratorFunctionPrototype.cs
index 5ffa2aca9e..0473c7034c 100644
--- a/Jint/Native/Generator/GeneratorFunctionPrototype.cs
+++ b/Jint/Native/Generator/GeneratorFunctionPrototype.cs
@@ -1,8 +1,8 @@
using Jint.Collections;
using Jint.Native.Function;
using Jint.Native.Iterator;
-using Jint.Native.Object;
using Jint.Native.Symbol;
+using Jint.Runtime;
using Jint.Runtime.Descriptors;
namespace Jint.Native.Generator;
@@ -10,7 +10,7 @@ namespace Jint.Native.Generator;
///
/// https://tc39.es/ecma262/#sec-properties-of-the-generatorfunction-prototype-object
///
-internal sealed class GeneratorFunctionPrototype : ObjectInstance
+internal sealed class GeneratorFunctionPrototype : Prototype
{
private readonly GeneratorFunctionConstructor? _constructor;
@@ -18,7 +18,7 @@ internal GeneratorFunctionPrototype(
Engine engine,
GeneratorFunctionConstructor constructor,
FunctionPrototype prototype,
- IteratorPrototype iteratorPrototype) : base(engine)
+ IteratorPrototype iteratorPrototype) : base(engine, engine.Realm)
{
_constructor = constructor;
_prototype = prototype;
@@ -31,8 +31,8 @@ protected override void Initialize()
{
var properties = new PropertyDictionary(2, checkExistingKeys: false)
{
- ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.Configurable),
- ["prototype"] = new PropertyDescriptor(PrototypeObject, PropertyFlag.Configurable)
+ [KnownKeys.Constructor] = new PropertyDescriptor(_constructor, PropertyFlag.Configurable),
+ [KnownKeys.Prototype] = new PropertyDescriptor(PrototypeObject, PropertyFlag.Configurable)
};
SetProperties(properties);
var symbols = new SymbolDictionary(1)
diff --git a/Jint/Runtime/KnownKeys.cs b/Jint/Runtime/KnownKeys.cs
index 23ccc8d7a6..9fd56b94eb 100644
--- a/Jint/Runtime/KnownKeys.cs
+++ b/Jint/Runtime/KnownKeys.cs
@@ -4,11 +4,12 @@ internal static class KnownKeys
{
internal static readonly Key Arguments = "arguments";
internal static readonly Key Caller = "caller";
+ internal static readonly Key Constructor = "constructor";
+ internal static readonly Key Done = "done";
internal static readonly Key Eval = "eval";
internal static readonly Key Length = "length";
- internal static readonly Key Done = "done";
- internal static readonly Key Value = "value";
- internal static readonly Key Undefined = "undefined";
- internal static readonly Key Constructor = "constructor";
internal static readonly Key Next = "next";
+ internal static readonly Key Prototype = "prototype";
+ internal static readonly Key Undefined = "undefined";
+ internal static readonly Key Value = "value";
}