Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed Dec 30, 2023
1 parent 5ea001e commit 57ae096
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Jint/Native/Function/ClassDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Jint/Native/Generator/GeneratorFunctionConstructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Jint.Native.Generator;
/// <summary>
/// https://tc39.es/ecma262/#sec-generatorfunction-constructor
/// </summary>
internal sealed class GeneratorFunctionConstructor : FunctionInstance, IConstructor
internal sealed class GeneratorFunctionConstructor : Constructor
{
private static readonly JsString _functionName = new("GeneratorFunction");

Expand All @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions Jint/Native/Generator/GeneratorFunctionPrototype.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
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;

/// <summary>
/// https://tc39.es/ecma262/#sec-properties-of-the-generatorfunction-prototype-object
/// </summary>
internal sealed class GeneratorFunctionPrototype : ObjectInstance
internal sealed class GeneratorFunctionPrototype : Prototype
{
private readonly GeneratorFunctionConstructor? _constructor;

internal GeneratorFunctionPrototype(
Engine engine,
GeneratorFunctionConstructor constructor,
FunctionPrototype prototype,
IteratorPrototype iteratorPrototype) : base(engine)
IteratorPrototype iteratorPrototype) : base(engine, engine.Realm)
{
_constructor = constructor;
_prototype = prototype;
Expand All @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions Jint/Runtime/KnownKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

0 comments on commit 57ae096

Please sign in to comment.