|
@@ -105,23 +105,36 @@ namespace Jint.Native.Function
|
|
|
|
|
|
public override List<JsValue> GetOwnPropertyKeys(Types types)
|
|
public override List<JsValue> GetOwnPropertyKeys(Types types)
|
|
{
|
|
{
|
|
- var keys = new List<JsValue>();
|
|
|
|
- if (_prototypeDescriptor != null)
|
|
|
|
|
|
+ var keys = base.GetOwnPropertyKeys(types);
|
|
|
|
+
|
|
|
|
+ // works around a problem where we don't use property for function names and classes should report it last
|
|
|
|
+ // as it's the last operation when creating a class constructor
|
|
|
|
+ if ((types & Types.String) != 0 && _nameDescriptor != null && this is ScriptFunctionInstance { _isClassConstructor: true })
|
|
{
|
|
{
|
|
- keys.Add(CommonProperties.Prototype);
|
|
|
|
|
|
+ keys.Add(CommonProperties.Name);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return keys;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ internal override IEnumerable<JsValue> GetInitialOwnStringPropertyKeys()
|
|
|
|
+ {
|
|
if (_length != null)
|
|
if (_length != null)
|
|
{
|
|
{
|
|
- keys.Add(CommonProperties.Length);
|
|
|
|
|
|
+ yield return CommonProperties.Length;
|
|
}
|
|
}
|
|
- if (_nameDescriptor != null)
|
|
|
|
|
|
+
|
|
|
|
+ // works around a problem where we don't use property for function names and classes should report it last
|
|
|
|
+ // as it's the last operation when creating a class constructor
|
|
|
|
+ if (_nameDescriptor != null && this is not ScriptFunctionInstance { _isClassConstructor: true })
|
|
{
|
|
{
|
|
- keys.Add(CommonProperties.Name);
|
|
|
|
|
|
+ yield return CommonProperties.Name;
|
|
}
|
|
}
|
|
|
|
|
|
- keys.AddRange(base.GetOwnPropertyKeys(types));
|
|
|
|
-
|
|
|
|
- return keys;
|
|
|
|
|
|
+ if (_prototypeDescriptor != null)
|
|
|
|
+ {
|
|
|
|
+ yield return CommonProperties.Prototype;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public override PropertyDescriptor GetOwnProperty(JsValue property)
|
|
public override PropertyDescriptor GetOwnProperty(JsValue property)
|