|
@@ -22,20 +22,21 @@ namespace Jint.Native.Object
|
|
{
|
|
{
|
|
public class ObjectInstance : JsValue, IEquatable<ObjectInstance>
|
|
public class ObjectInstance : JsValue, IEquatable<ObjectInstance>
|
|
{
|
|
{
|
|
- private StringDictionarySlim<PropertyDescriptor> _properties;
|
|
|
|
-
|
|
|
|
private bool _initialized;
|
|
private bool _initialized;
|
|
- internal bool _hasSymbols;
|
|
|
|
|
|
+ private readonly ObjectClass _class;
|
|
|
|
+
|
|
|
|
+ private PropertyDictionary _properties;
|
|
|
|
+ internal SymbolDictionary _symbols;
|
|
|
|
|
|
internal ObjectInstance _prototype;
|
|
internal ObjectInstance _prototype;
|
|
- private readonly string _class;
|
|
|
|
protected readonly Engine _engine;
|
|
protected readonly Engine _engine;
|
|
|
|
|
|
- public ObjectInstance(Engine engine) : this(engine, "Object")
|
|
|
|
|
|
+ public ObjectInstance(Engine engine) : this(engine, ObjectClass.Object)
|
|
{
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
- protected ObjectInstance(Engine engine, string objectClass) : base(Types.Object)
|
|
|
|
|
|
+ internal ObjectInstance(Engine engine, ObjectClass objectClass, InternalTypes type = InternalTypes.Object)
|
|
|
|
+ : base(type)
|
|
{
|
|
{
|
|
_engine = engine;
|
|
_engine = engine;
|
|
_class = objectClass;
|
|
_class = objectClass;
|
|
@@ -63,25 +64,20 @@ namespace Jint.Native.Object
|
|
/// </summary>
|
|
/// </summary>
|
|
public virtual bool Extensible { get; private set; }
|
|
public virtual bool Extensible { get; private set; }
|
|
|
|
|
|
- internal bool Initialized
|
|
|
|
- {
|
|
|
|
- [DebuggerStepThrough]
|
|
|
|
- get => _initialized;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- internal StringDictionarySlim<PropertyDescriptor> Properties
|
|
|
|
|
|
+ internal PropertyDictionary Properties
|
|
{
|
|
{
|
|
[DebuggerStepThrough]
|
|
[DebuggerStepThrough]
|
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
get => _properties;
|
|
get => _properties;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// A String value indicating a specification defined
|
|
|
|
- /// classification of objects.
|
|
|
|
|
|
+ /// A value indicating a specification defined classification of objects.
|
|
/// </summary>
|
|
/// </summary>
|
|
- public string Class
|
|
|
|
|
|
+ internal ObjectClass Class
|
|
{
|
|
{
|
|
[DebuggerStepThrough]
|
|
[DebuggerStepThrough]
|
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
get => _class;
|
|
get => _class;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -100,7 +96,7 @@ namespace Jint.Native.Object
|
|
/// </summary>
|
|
/// </summary>
|
|
internal static IConstructor SpeciesConstructor(ObjectInstance o, IConstructor defaultConstructor)
|
|
internal static IConstructor SpeciesConstructor(ObjectInstance o, IConstructor defaultConstructor)
|
|
{
|
|
{
|
|
- var c = o.Get(KnownKeys.Constructor);
|
|
|
|
|
|
+ var c = o.Get(CommonProperties.Constructor);
|
|
if (c.IsUndefined())
|
|
if (c.IsUndefined())
|
|
{
|
|
{
|
|
return defaultConstructor;
|
|
return defaultConstructor;
|
|
@@ -126,27 +122,77 @@ namespace Jint.Native.Object
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
- internal void SetProperties(StringDictionarySlim<PropertyDescriptor> properties, bool hasSymbols)
|
|
|
|
|
|
+ internal void SetProperties(PropertyDictionary properties)
|
|
{
|
|
{
|
|
|
|
+ if (properties != null)
|
|
|
|
+ {
|
|
|
|
+ properties.CheckExistingKeys = true;
|
|
|
|
+ }
|
|
_properties = properties;
|
|
_properties = properties;
|
|
- _hasSymbols = hasSymbols;
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ internal void SetSymbols(SymbolDictionary symbols)
|
|
|
|
+ {
|
|
|
|
+ _symbols = symbols;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
+ internal void SetProperty(JsValue property, PropertyDescriptor value)
|
|
|
|
+ {
|
|
|
|
+ if (property is JsString jsString)
|
|
|
|
+ {
|
|
|
|
+ SetProperty(jsString.ToString(), value);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ SetPropertyUnlikely(property, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
+ internal void SetProperty(string property, PropertyDescriptor value)
|
|
|
|
+ {
|
|
|
|
+ Key key = property;
|
|
|
|
+ SetProperty(in key, value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
+ internal void SetProperty(in Key property, PropertyDescriptor value)
|
|
|
|
+ {
|
|
|
|
+ _properties ??= new PropertyDictionary();
|
|
|
|
+ _properties[property] = value;
|
|
}
|
|
}
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
- internal void SetProperty(in Key propertyName, PropertyDescriptor value)
|
|
|
|
|
|
+ internal void SetDataProperty(string property, JsValue value)
|
|
{
|
|
{
|
|
- _properties[propertyName] = value;
|
|
|
|
- _hasSymbols |= propertyName.IsSymbol;
|
|
|
|
|
|
+ _properties ??= new PropertyDictionary();
|
|
|
|
+ _properties[property] = new PropertyDescriptor(value, PropertyFlag.ConfigurableEnumerableWritable);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
+ private void SetPropertyUnlikely(JsValue property, PropertyDescriptor value)
|
|
|
|
+ {
|
|
|
|
+ var propertyKey = TypeConverter.ToPropertyKey(property);
|
|
|
|
+ if (!property.IsSymbol())
|
|
|
|
+ {
|
|
|
|
+ _properties ??= new PropertyDictionary();
|
|
|
|
+ _properties[TypeConverter.ToString(propertyKey)] = value;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ _symbols ??= new SymbolDictionary();
|
|
|
|
+ _symbols[(JsSymbol) propertyKey] = value;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
internal void ClearProperties()
|
|
internal void ClearProperties()
|
|
{
|
|
{
|
|
_properties?.Clear();
|
|
_properties?.Clear();
|
|
- _hasSymbols = false;
|
|
|
|
|
|
+ _symbols?.Clear();
|
|
}
|
|
}
|
|
|
|
|
|
- public virtual IEnumerable<KeyValuePair<Key, PropertyDescriptor>> GetOwnProperties()
|
|
|
|
|
|
+ public virtual IEnumerable<KeyValuePair<JsValue, PropertyDescriptor>> GetOwnProperties()
|
|
{
|
|
{
|
|
EnsureInitialized();
|
|
EnsureInitialized();
|
|
|
|
|
|
@@ -154,7 +200,15 @@ namespace Jint.Native.Object
|
|
{
|
|
{
|
|
foreach (var pair in _properties)
|
|
foreach (var pair in _properties)
|
|
{
|
|
{
|
|
- yield return pair;
|
|
|
|
|
|
+ yield return new KeyValuePair<JsValue, PropertyDescriptor>(new JsString(pair.Key), pair.Value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (_symbols != null)
|
|
|
|
+ {
|
|
|
|
+ foreach (var pair in _symbols)
|
|
|
|
+ {
|
|
|
|
+ yield return new KeyValuePair<JsValue, PropertyDescriptor>(pair.Key, pair.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -163,44 +217,38 @@ namespace Jint.Native.Object
|
|
{
|
|
{
|
|
EnsureInitialized();
|
|
EnsureInitialized();
|
|
|
|
|
|
- if (_properties == null)
|
|
|
|
- {
|
|
|
|
- return new List<JsValue>();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var keys = new List<JsValue>(_properties.Count);
|
|
|
|
|
|
+ var keys = new List<JsValue>(_properties?.Count ?? 0 + _symbols?.Count ?? 0);
|
|
var propertyKeys = new List<JsValue>();
|
|
var propertyKeys = new List<JsValue>();
|
|
List<JsValue> symbolKeys = null;
|
|
List<JsValue> symbolKeys = null;
|
|
-
|
|
|
|
- foreach (var pair in _properties)
|
|
|
|
|
|
+
|
|
|
|
+ if ((types & Types.String) != 0 && _properties != null)
|
|
{
|
|
{
|
|
- if ((pair.Key.Type & types) == 0)
|
|
|
|
- {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var isArrayIndex = ulong.TryParse(pair.Key, out var index);
|
|
|
|
- if (pair.Key.Type != Types.Symbol)
|
|
|
|
|
|
+ foreach (var pair in _properties)
|
|
{
|
|
{
|
|
|
|
+ var isArrayIndex = ulong.TryParse(pair.Key, out var index);
|
|
if (isArrayIndex)
|
|
if (isArrayIndex)
|
|
{
|
|
{
|
|
- keys.Add(pair.Key);
|
|
|
|
|
|
+ keys.Add(JsString.Create(index));
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- propertyKeys.Add(pair.Key);
|
|
|
|
|
|
+ propertyKeys.Add(new JsString(pair.Key));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ keys.Sort((v1, v2) => TypeConverter.ToNumber(v1).CompareTo(TypeConverter.ToNumber(v2)));
|
|
|
|
+ keys.AddRange(propertyKeys);
|
|
|
|
+
|
|
|
|
+ if ((types & Types.Symbol) != 0 && _symbols != null)
|
|
|
|
+ {
|
|
|
|
+ foreach (var pair in _symbols)
|
|
{
|
|
{
|
|
symbolKeys ??= new List<JsValue>();
|
|
symbolKeys ??= new List<JsValue>();
|
|
symbolKeys.Add(pair.Key);
|
|
symbolKeys.Add(pair.Key);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- keys.Sort((v1, v2) => TypeConverter.ToNumber(v1).CompareTo(TypeConverter.ToNumber(v2)));
|
|
|
|
|
|
|
|
- keys.AddRange(propertyKeys);
|
|
|
|
if (symbolKeys != null)
|
|
if (symbolKeys != null)
|
|
{
|
|
{
|
|
keys.AddRange(symbolKeys);
|
|
keys.AddRange(symbolKeys);
|
|
@@ -210,44 +258,54 @@ namespace Jint.Native.Object
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- protected virtual void AddProperty(in Key propertyName, PropertyDescriptor descriptor)
|
|
|
|
|
|
+ protected virtual void AddProperty(JsValue property, PropertyDescriptor descriptor)
|
|
{
|
|
{
|
|
- if (_properties == null)
|
|
|
|
- {
|
|
|
|
- _properties = new StringDictionarySlim<PropertyDescriptor>();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- SetProperty(propertyName, descriptor);
|
|
|
|
|
|
+ SetProperty(property, descriptor);
|
|
}
|
|
}
|
|
|
|
|
|
- protected virtual bool TryGetProperty(in Key propertyName, out PropertyDescriptor descriptor)
|
|
|
|
|
|
+ protected virtual bool TryGetProperty(JsValue property, out PropertyDescriptor descriptor)
|
|
{
|
|
{
|
|
- if (_properties == null)
|
|
|
|
|
|
+ descriptor = null;
|
|
|
|
+
|
|
|
|
+ var key = TypeConverter.ToPropertyKey(property);
|
|
|
|
+ if (!key.IsSymbol())
|
|
{
|
|
{
|
|
- descriptor = null;
|
|
|
|
- return false;
|
|
|
|
|
|
+ return _properties?.TryGetValue(TypeConverter.ToString(key), out descriptor) == true;
|
|
}
|
|
}
|
|
|
|
|
|
- return _properties.TryGetValue(propertyName, out descriptor);
|
|
|
|
|
|
+ return _symbols?.TryGetValue((JsSymbol) key, out descriptor) == true;
|
|
}
|
|
}
|
|
|
|
|
|
- public virtual bool HasOwnProperty(in Key propertyName)
|
|
|
|
|
|
+ public virtual bool HasOwnProperty(JsValue property)
|
|
{
|
|
{
|
|
EnsureInitialized();
|
|
EnsureInitialized();
|
|
|
|
|
|
- return _properties?.ContainsKey(propertyName) == true;
|
|
|
|
|
|
+ var key = TypeConverter.ToPropertyKey(property);
|
|
|
|
+ if (!key.IsSymbol())
|
|
|
|
+ {
|
|
|
|
+ return _properties?.ContainsKey(TypeConverter.ToString(key)) == true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return _symbols?.ContainsKey((JsSymbol) key) == true;
|
|
}
|
|
}
|
|
|
|
|
|
- public virtual void RemoveOwnProperty(in Key propertyName)
|
|
|
|
|
|
+ public virtual void RemoveOwnProperty(JsValue property)
|
|
{
|
|
{
|
|
EnsureInitialized();
|
|
EnsureInitialized();
|
|
|
|
|
|
- _properties?.Remove(propertyName);
|
|
|
|
|
|
+ var key = TypeConverter.ToPropertyKey(property);
|
|
|
|
+ if (!key.IsSymbol())
|
|
|
|
+ {
|
|
|
|
+ _properties?.Remove(TypeConverter.ToString(key));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ _symbols?.Remove((JsSymbol) key);
|
|
}
|
|
}
|
|
|
|
|
|
- public override JsValue Get(in Key propertyName, JsValue receiver)
|
|
|
|
|
|
+ public override JsValue Get(JsValue property, JsValue receiver)
|
|
{
|
|
{
|
|
- var desc = GetProperty(propertyName);
|
|
|
|
|
|
+ var desc = GetProperty(property);
|
|
return UnwrapJsValue(desc, receiver);
|
|
return UnwrapJsValue(desc, receiver);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -292,54 +350,50 @@ namespace Jint.Native.Object
|
|
/// absent.
|
|
/// absent.
|
|
/// http://www.ecma-international.org/ecma-262/5.1/#sec-8.12.1
|
|
/// http://www.ecma-international.org/ecma-262/5.1/#sec-8.12.1
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="propertyName"></param>
|
|
|
|
- /// <returns></returns>
|
|
|
|
- public virtual PropertyDescriptor GetOwnProperty(in Key propertyName)
|
|
|
|
|
|
+ public virtual PropertyDescriptor GetOwnProperty(JsValue property)
|
|
{
|
|
{
|
|
EnsureInitialized();
|
|
EnsureInitialized();
|
|
|
|
|
|
PropertyDescriptor descriptor = null;
|
|
PropertyDescriptor descriptor = null;
|
|
- if (_properties != null && (!propertyName.IsSymbol || _hasSymbols))
|
|
|
|
|
|
+ var key = TypeConverter.ToPropertyKey(property);
|
|
|
|
+ if (!key.IsSymbol())
|
|
|
|
+ {
|
|
|
|
+ _properties?.TryGetValue(TypeConverter.ToString(key), out descriptor);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- _properties.TryGetValue(propertyName, out descriptor);
|
|
|
|
|
|
+ _symbols?.TryGetValue((JsSymbol) key, out descriptor);
|
|
}
|
|
}
|
|
|
|
+
|
|
return descriptor ?? PropertyDescriptor.Undefined;
|
|
return descriptor ?? PropertyDescriptor.Undefined;
|
|
}
|
|
}
|
|
|
|
|
|
- protected internal virtual void SetOwnProperty(in Key propertyName, PropertyDescriptor desc)
|
|
|
|
|
|
+ protected internal virtual void SetOwnProperty(JsValue property, PropertyDescriptor desc)
|
|
{
|
|
{
|
|
EnsureInitialized();
|
|
EnsureInitialized();
|
|
-
|
|
|
|
- if (_properties == null)
|
|
|
|
- {
|
|
|
|
- _properties = new StringDictionarySlim<PropertyDescriptor>();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- SetProperty(propertyName, desc);
|
|
|
|
|
|
+ SetProperty(property, desc);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// http://www.ecma-international.org/ecma-262/5.1/#sec-8.12.2
|
|
/// http://www.ecma-international.org/ecma-262/5.1/#sec-8.12.2
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="propertyName"></param>
|
|
|
|
- /// <returns></returns>
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
- public PropertyDescriptor GetProperty(in Key propertyName)
|
|
|
|
|
|
+ public PropertyDescriptor GetProperty(JsValue property)
|
|
{
|
|
{
|
|
- var prop = GetOwnProperty(propertyName);
|
|
|
|
|
|
+ var prop = GetOwnProperty(property);
|
|
|
|
|
|
if (prop != PropertyDescriptor.Undefined)
|
|
if (prop != PropertyDescriptor.Undefined)
|
|
{
|
|
{
|
|
return prop;
|
|
return prop;
|
|
}
|
|
}
|
|
|
|
|
|
- return Prototype?.GetProperty(propertyName) ?? PropertyDescriptor.Undefined;
|
|
|
|
|
|
+ return Prototype?.GetProperty(property) ?? PropertyDescriptor.Undefined;
|
|
}
|
|
}
|
|
|
|
|
|
- public bool TryGetValue(in Key propertyName, out JsValue value)
|
|
|
|
|
|
+ public bool TryGetValue(JsValue property, out JsValue value)
|
|
{
|
|
{
|
|
value = Undefined;
|
|
value = Undefined;
|
|
- var desc = GetOwnProperty(propertyName);
|
|
|
|
|
|
+ var desc = GetOwnProperty(property);
|
|
if (desc != null && desc != PropertyDescriptor.Undefined)
|
|
if (desc != null && desc != PropertyDescriptor.Undefined)
|
|
{
|
|
{
|
|
if (desc == PropertyDescriptor.Undefined)
|
|
if (desc == PropertyDescriptor.Undefined)
|
|
@@ -372,11 +426,11 @@ namespace Jint.Native.Object
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- return Prototype.TryGetValue(propertyName, out value);
|
|
|
|
|
|
+ return Prototype.TryGetValue(property, out value);
|
|
}
|
|
}
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
- public bool Set(Key p, JsValue v, bool throwOnError)
|
|
|
|
|
|
+ public bool Set(JsValue p, JsValue v, bool throwOnError)
|
|
{
|
|
{
|
|
if (!Set(p, v, this) && throwOnError)
|
|
if (!Set(p, v, this) && throwOnError)
|
|
{
|
|
{
|
|
@@ -387,21 +441,21 @@ namespace Jint.Native.Object
|
|
}
|
|
}
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
- public bool Set(in Key propertyName, JsValue value)
|
|
|
|
|
|
+ public bool Set(JsValue property, JsValue value)
|
|
{
|
|
{
|
|
- return Set(propertyName, value, this);
|
|
|
|
|
|
+ return Set(property, value, this);
|
|
}
|
|
}
|
|
|
|
|
|
- public override bool Set(in Key propertyName, JsValue value, JsValue receiver)
|
|
|
|
|
|
+ public override bool Set(JsValue property, JsValue value, JsValue receiver)
|
|
{
|
|
{
|
|
- var ownDesc = GetOwnProperty(propertyName);
|
|
|
|
|
|
+ var ownDesc = GetOwnProperty(property);
|
|
|
|
|
|
if (ownDesc == PropertyDescriptor.Undefined)
|
|
if (ownDesc == PropertyDescriptor.Undefined)
|
|
{
|
|
{
|
|
var parent = GetPrototypeOf();
|
|
var parent = GetPrototypeOf();
|
|
if (!(parent is null))
|
|
if (!(parent is null))
|
|
{
|
|
{
|
|
- return parent.Set(propertyName, value, receiver);
|
|
|
|
|
|
+ return parent.Set(property, value, receiver);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -421,7 +475,7 @@ namespace Jint.Native.Object
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- var existingDescriptor = oi.GetOwnProperty(propertyName);
|
|
|
|
|
|
+ var existingDescriptor = oi.GetOwnProperty(property);
|
|
if (existingDescriptor != PropertyDescriptor.Undefined)
|
|
if (existingDescriptor != PropertyDescriptor.Undefined)
|
|
{
|
|
{
|
|
if (existingDescriptor.IsAccessorDescriptor())
|
|
if (existingDescriptor.IsAccessorDescriptor())
|
|
@@ -435,11 +489,11 @@ namespace Jint.Native.Object
|
|
}
|
|
}
|
|
|
|
|
|
var valueDesc = new PropertyDescriptor(value, PropertyFlag.None);
|
|
var valueDesc = new PropertyDescriptor(value, PropertyFlag.None);
|
|
- return oi.DefineOwnProperty(propertyName, valueDesc);
|
|
|
|
|
|
+ return oi.DefineOwnProperty(property, valueDesc);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- return oi.CreateDataProperty(propertyName, value);
|
|
|
|
|
|
+ return oi.CreateDataProperty(property, value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -452,16 +506,16 @@ namespace Jint.Native.Object
|
|
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Returns a Boolean value indicating whether a
|
|
/// Returns a Boolean value indicating whether a
|
|
/// [[Put]] operation with PropertyName can be
|
|
/// [[Put]] operation with PropertyName can be
|
|
/// performed.
|
|
/// performed.
|
|
/// http://www.ecma-international.org/ecma-262/5.1/#sec-8.12.4
|
|
/// http://www.ecma-international.org/ecma-262/5.1/#sec-8.12.4
|
|
/// </summary>
|
|
/// </summary>
|
|
- public bool CanPut(in Key propertyName)
|
|
|
|
|
|
+ public bool CanPut(JsValue property)
|
|
{
|
|
{
|
|
- var desc = GetOwnProperty(propertyName);
|
|
|
|
|
|
+ var desc = GetOwnProperty(property);
|
|
|
|
|
|
if (desc != PropertyDescriptor.Undefined)
|
|
if (desc != PropertyDescriptor.Undefined)
|
|
{
|
|
{
|
|
@@ -484,7 +538,7 @@ namespace Jint.Native.Object
|
|
return Extensible;
|
|
return Extensible;
|
|
}
|
|
}
|
|
|
|
|
|
- var inherited = Prototype.GetProperty(propertyName);
|
|
|
|
|
|
+ var inherited = Prototype.GetProperty(property);
|
|
|
|
|
|
if (inherited == PropertyDescriptor.Undefined)
|
|
if (inherited == PropertyDescriptor.Undefined)
|
|
{
|
|
{
|
|
@@ -513,9 +567,9 @@ namespace Jint.Native.Object
|
|
/// <summary>
|
|
/// <summary>
|
|
/// http://www.ecma-international.org/ecma-262/#sec-ordinary-object-internal-methods-and-internal-slots-hasproperty-p
|
|
/// http://www.ecma-international.org/ecma-262/#sec-ordinary-object-internal-methods-and-internal-slots-hasproperty-p
|
|
/// </summary>
|
|
/// </summary>
|
|
- public virtual bool HasProperty(in Key propertyName)
|
|
|
|
|
|
+ public virtual bool HasProperty(JsValue property)
|
|
{
|
|
{
|
|
- var hasOwn = GetOwnProperty(propertyName);
|
|
|
|
|
|
+ var hasOwn = GetOwnProperty(property);
|
|
if (hasOwn != PropertyDescriptor.Undefined)
|
|
if (hasOwn != PropertyDescriptor.Undefined)
|
|
{
|
|
{
|
|
return true;
|
|
return true;
|
|
@@ -524,7 +578,7 @@ namespace Jint.Native.Object
|
|
var parent = GetPrototypeOf();
|
|
var parent = GetPrototypeOf();
|
|
if (parent != null)
|
|
if (parent != null)
|
|
{
|
|
{
|
|
- return parent.HasProperty(propertyName);
|
|
|
|
|
|
+ return parent.HasProperty(property);
|
|
}
|
|
}
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -533,23 +587,23 @@ namespace Jint.Native.Object
|
|
/// <summary>
|
|
/// <summary>
|
|
/// http://www.ecma-international.org/ecma-262/#sec-deletepropertyorthrow
|
|
/// http://www.ecma-international.org/ecma-262/#sec-deletepropertyorthrow
|
|
/// </summary>
|
|
/// </summary>
|
|
- public bool DeletePropertyOrThrow(in Key propertyName)
|
|
|
|
|
|
+ public bool DeletePropertyOrThrow(JsValue property)
|
|
{
|
|
{
|
|
- if (!Delete(propertyName))
|
|
|
|
|
|
+ if (!Delete(property))
|
|
{
|
|
{
|
|
ExceptionHelper.ThrowTypeError(Engine);
|
|
ExceptionHelper.ThrowTypeError(Engine);
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Removes the specified named own property
|
|
/// Removes the specified named own property
|
|
/// from the object. The flag controls failure
|
|
/// from the object. The flag controls failure
|
|
/// handling.
|
|
/// handling.
|
|
/// </summary>
|
|
/// </summary>
|
|
- public virtual bool Delete(in Key propertyName)
|
|
|
|
|
|
+ public virtual bool Delete(JsValue property)
|
|
{
|
|
{
|
|
- var desc = GetOwnProperty(propertyName);
|
|
|
|
|
|
+ var desc = GetOwnProperty(property);
|
|
|
|
|
|
if (desc == PropertyDescriptor.Undefined)
|
|
if (desc == PropertyDescriptor.Undefined)
|
|
{
|
|
{
|
|
@@ -558,31 +612,31 @@ namespace Jint.Native.Object
|
|
|
|
|
|
if (desc.Configurable)
|
|
if (desc.Configurable)
|
|
{
|
|
{
|
|
- RemoveOwnProperty(propertyName);
|
|
|
|
|
|
+ RemoveOwnProperty(property);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- public bool DefinePropertyOrThrow(in Key propertyName, PropertyDescriptor desc)
|
|
|
|
|
|
+ public bool DefinePropertyOrThrow(JsValue property, PropertyDescriptor desc)
|
|
{
|
|
{
|
|
- if (!DefineOwnProperty(propertyName, desc))
|
|
|
|
|
|
+ if (!DefineOwnProperty(property, desc))
|
|
{
|
|
{
|
|
ExceptionHelper.ThrowTypeError(_engine);
|
|
ExceptionHelper.ThrowTypeError(_engine);
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
return true;
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Creates or alters the named own property to
|
|
/// Creates or alters the named own property to
|
|
/// have the state described by a Property
|
|
/// have the state described by a Property
|
|
/// Descriptor. The flag controls failure handling.
|
|
/// Descriptor. The flag controls failure handling.
|
|
/// </summary>
|
|
/// </summary>
|
|
- public virtual bool DefineOwnProperty(in Key propertyName, PropertyDescriptor desc)
|
|
|
|
|
|
+ public virtual bool DefineOwnProperty(JsValue property, PropertyDescriptor desc)
|
|
{
|
|
{
|
|
- var current = GetOwnProperty(propertyName);
|
|
|
|
|
|
+ var current = GetOwnProperty(property);
|
|
var extensible = Extensible;
|
|
var extensible = Extensible;
|
|
|
|
|
|
if (current == desc)
|
|
if (current == desc)
|
|
@@ -590,13 +644,13 @@ namespace Jint.Native.Object
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- return ValidateAndApplyPropertyDescriptor(this, propertyName, extensible, desc, current);
|
|
|
|
|
|
+ return ValidateAndApplyPropertyDescriptor(this, property, extensible, desc, current);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// http://www.ecma-international.org/ecma-262/#sec-validateandapplypropertydescriptor
|
|
/// http://www.ecma-international.org/ecma-262/#sec-validateandapplypropertydescriptor
|
|
/// </summary>
|
|
/// </summary>
|
|
- protected static bool ValidateAndApplyPropertyDescriptor(ObjectInstance o, in Key propertyName, bool extensible, PropertyDescriptor desc, PropertyDescriptor current)
|
|
|
|
|
|
+ protected static bool ValidateAndApplyPropertyDescriptor(ObjectInstance o, JsValue property, bool extensible, PropertyDescriptor desc, PropertyDescriptor current)
|
|
{
|
|
{
|
|
var descValue = desc.Value;
|
|
var descValue = desc.Value;
|
|
if (current == PropertyDescriptor.Undefined)
|
|
if (current == PropertyDescriptor.Undefined)
|
|
@@ -627,11 +681,11 @@ namespace Jint.Native.Object
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
- o.SetOwnProperty(propertyName, propertyDescriptor);
|
|
|
|
|
|
+ o.SetOwnProperty(property, propertyDescriptor);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- o.SetOwnProperty(propertyName, new GetSetPropertyDescriptor(desc));
|
|
|
|
|
|
+ o.SetOwnProperty(property, new GetSetPropertyDescriptor(desc));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -694,7 +748,7 @@ namespace Jint.Native.Object
|
|
var flags = current.Flags & ~(PropertyFlag.Writable | PropertyFlag.WritableSet);
|
|
var flags = current.Flags & ~(PropertyFlag.Writable | PropertyFlag.WritableSet);
|
|
if (current.IsDataDescriptor())
|
|
if (current.IsDataDescriptor())
|
|
{
|
|
{
|
|
- o.SetOwnProperty(propertyName, current = new GetSetPropertyDescriptor(
|
|
|
|
|
|
+ o.SetOwnProperty(property, current = new GetSetPropertyDescriptor(
|
|
get: Undefined,
|
|
get: Undefined,
|
|
set: Undefined,
|
|
set: Undefined,
|
|
flags
|
|
flags
|
|
@@ -702,7 +756,7 @@ namespace Jint.Native.Object
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- o.SetOwnProperty(propertyName, current = new PropertyDescriptor(
|
|
|
|
|
|
+ o.SetOwnProperty(property, current = new PropertyDescriptor(
|
|
value: Undefined,
|
|
value: Undefined,
|
|
flags
|
|
flags
|
|
));
|
|
));
|
|
@@ -780,7 +834,7 @@ namespace Jint.Native.Object
|
|
if (mutable != null)
|
|
if (mutable != null)
|
|
{
|
|
{
|
|
// replace old with new type that supports get and set
|
|
// replace old with new type that supports get and set
|
|
- o.FastSetProperty(propertyName, mutable);
|
|
|
|
|
|
+ o.FastSetProperty(property, mutable);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -790,12 +844,7 @@ namespace Jint.Native.Object
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Optimized version of [[Put]] when the property is known to be undeclared already
|
|
/// Optimized version of [[Put]] when the property is known to be undeclared already
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="name"></param>
|
|
|
|
- /// <param name="value"></param>
|
|
|
|
- /// <param name="writable"></param>
|
|
|
|
- /// <param name="configurable"></param>
|
|
|
|
- /// <param name="enumerable"></param>
|
|
|
|
- public void FastAddProperty(string name, JsValue value, bool writable, bool enumerable, bool configurable)
|
|
|
|
|
|
+ public void FastAddProperty(JsValue name, JsValue value, bool writable, bool enumerable, bool configurable)
|
|
{
|
|
{
|
|
SetOwnProperty(name, new PropertyDescriptor(value, writable, enumerable, configurable));
|
|
SetOwnProperty(name, new PropertyDescriptor(value, writable, enumerable, configurable));
|
|
}
|
|
}
|
|
@@ -805,19 +854,22 @@ namespace Jint.Native.Object
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="name"></param>
|
|
/// <param name="name"></param>
|
|
/// <param name="value"></param>
|
|
/// <param name="value"></param>
|
|
- public void FastSetProperty(in Key name, PropertyDescriptor value)
|
|
|
|
|
|
+ public void FastSetProperty(JsValue name, PropertyDescriptor value)
|
|
{
|
|
{
|
|
SetOwnProperty(name, value);
|
|
SetOwnProperty(name, value);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
protected void EnsureInitialized()
|
|
protected void EnsureInitialized()
|
|
{
|
|
{
|
|
- if (!_initialized)
|
|
|
|
|
|
+ if (_initialized)
|
|
{
|
|
{
|
|
- // we need to set flag eagerly to prevent wrong recursion
|
|
|
|
- _initialized = true;
|
|
|
|
- Initialize();
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // we need to set flag eagerly to prevent wrong recursion
|
|
|
|
+ _initialized = true;
|
|
|
|
+ Initialize();
|
|
}
|
|
}
|
|
|
|
|
|
protected virtual void Initialize()
|
|
protected virtual void Initialize()
|
|
@@ -838,14 +890,14 @@ namespace Jint.Native.Object
|
|
|
|
|
|
switch (Class)
|
|
switch (Class)
|
|
{
|
|
{
|
|
- case "Array":
|
|
|
|
|
|
+ case ObjectClass.Array:
|
|
if (this is ArrayInstance arrayInstance)
|
|
if (this is ArrayInstance arrayInstance)
|
|
{
|
|
{
|
|
- var len = TypeConverter.ToInt32(arrayInstance.Get("length", arrayInstance));
|
|
|
|
|
|
+ var len = TypeConverter.ToInt32(arrayInstance.Get(CommonProperties.Length, arrayInstance));
|
|
var result = new object[len];
|
|
var result = new object[len];
|
|
for (var k = 0; k < len; k++)
|
|
for (var k = 0; k < len; k++)
|
|
{
|
|
{
|
|
- var pk = TypeConverter.ToString(k);
|
|
|
|
|
|
+ var pk = TypeConverter.ToJsString(k);
|
|
var kpresent = arrayInstance.HasProperty(pk);
|
|
var kpresent = arrayInstance.HasProperty(pk);
|
|
if (kpresent)
|
|
if (kpresent)
|
|
{
|
|
{
|
|
@@ -863,7 +915,7 @@ namespace Jint.Native.Object
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
- case "String":
|
|
|
|
|
|
+ case ObjectClass.String:
|
|
if (this is StringInstance stringInstance)
|
|
if (this is StringInstance stringInstance)
|
|
{
|
|
{
|
|
return stringInstance.PrimitiveValue.ToString();
|
|
return stringInstance.PrimitiveValue.ToString();
|
|
@@ -871,7 +923,7 @@ namespace Jint.Native.Object
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
- case "Date":
|
|
|
|
|
|
+ case ObjectClass.Date:
|
|
if (this is DateInstance dateInstance)
|
|
if (this is DateInstance dateInstance)
|
|
{
|
|
{
|
|
return dateInstance.ToDateTime();
|
|
return dateInstance.ToDateTime();
|
|
@@ -879,7 +931,7 @@ namespace Jint.Native.Object
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
- case "Boolean":
|
|
|
|
|
|
+ case ObjectClass.Boolean:
|
|
if (this is BooleanInstance booleanInstance)
|
|
if (this is BooleanInstance booleanInstance)
|
|
{
|
|
{
|
|
return ((JsBoolean) booleanInstance.PrimitiveValue)._value
|
|
return ((JsBoolean) booleanInstance.PrimitiveValue)._value
|
|
@@ -889,7 +941,7 @@ namespace Jint.Native.Object
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
- case "Function":
|
|
|
|
|
|
+ case ObjectClass.Function:
|
|
if (this is FunctionInstance function)
|
|
if (this is FunctionInstance function)
|
|
{
|
|
{
|
|
return (Func<JsValue, JsValue[], JsValue>) function.Call;
|
|
return (Func<JsValue, JsValue[], JsValue>) function.Call;
|
|
@@ -897,7 +949,7 @@ namespace Jint.Native.Object
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
- case "Number":
|
|
|
|
|
|
+ case ObjectClass.Number:
|
|
if (this is NumberInstance numberInstance)
|
|
if (this is NumberInstance numberInstance)
|
|
{
|
|
{
|
|
return numberInstance.NumberData._value;
|
|
return numberInstance.NumberData._value;
|
|
@@ -905,7 +957,7 @@ namespace Jint.Native.Object
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
- case "RegExp":
|
|
|
|
|
|
+ case ObjectClass.RegExp:
|
|
if (this is RegExpInstance regeExpInstance)
|
|
if (this is RegExpInstance regeExpInstance)
|
|
{
|
|
{
|
|
return regeExpInstance.Value;
|
|
return regeExpInstance.Value;
|
|
@@ -913,14 +965,9 @@ namespace Jint.Native.Object
|
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
|
- case "Arguments":
|
|
|
|
- case "Object":
|
|
|
|
-#if __IOS__
|
|
|
|
- IDictionary<string, object> o = new DictionarySlim<string, object>();
|
|
|
|
-#else
|
|
|
|
|
|
+ case ObjectClass.Arguments:
|
|
|
|
+ case ObjectClass.Object:
|
|
IDictionary<string, object> o = new ExpandoObject();
|
|
IDictionary<string, object> o = new ExpandoObject();
|
|
-#endif
|
|
|
|
-
|
|
|
|
foreach (var p in GetOwnProperties())
|
|
foreach (var p in GetOwnProperties())
|
|
{
|
|
{
|
|
if (!p.Value.Enumerable)
|
|
if (!p.Value.Enumerable)
|
|
@@ -928,7 +975,7 @@ namespace Jint.Native.Object
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- o.Add(p.Key, Get(p.Key, this).ToObject());
|
|
|
|
|
|
+ o.Add(p.Key.ToString(), Get(p.Key, this).ToObject());
|
|
}
|
|
}
|
|
|
|
|
|
return o;
|
|
return o;
|
|
@@ -949,7 +996,7 @@ namespace Jint.Native.Object
|
|
{
|
|
{
|
|
long GetLength()
|
|
long GetLength()
|
|
{
|
|
{
|
|
- var desc = GetProperty("length");
|
|
|
|
|
|
+ var desc = GetProperty(CommonProperties.Length);
|
|
var descValue = desc.Value;
|
|
var descValue = desc.Value;
|
|
double len;
|
|
double len;
|
|
if (desc.IsDataDescriptor() && !ReferenceEquals(descValue, null))
|
|
if (desc.IsDataDescriptor() && !ReferenceEquals(descValue, null))
|
|
@@ -977,7 +1024,7 @@ namespace Jint.Native.Object
|
|
|
|
|
|
bool TryGetValue(uint idx, out JsValue jsValue)
|
|
bool TryGetValue(uint idx, out JsValue jsValue)
|
|
{
|
|
{
|
|
- var property = TypeConverter.ToString(idx);
|
|
|
|
|
|
+ var property = JsString.Create(idx);
|
|
var kPresent = HasProperty(property);
|
|
var kPresent = HasProperty(property);
|
|
jsValue = kPresent ? Get(property, this) : Undefined;
|
|
jsValue = kPresent ? Get(property, this) : Undefined;
|
|
return kPresent;
|
|
return kPresent;
|
|
@@ -1043,11 +1090,12 @@ namespace Jint.Native.Object
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- internal virtual bool IsArrayLike => TryGetValue(KnownKeys.Length, out var lengthValue)
|
|
|
|
|
|
+ internal virtual bool IsArrayLike => TryGetValue(CommonProperties.Length, out var lengthValue)
|
|
&& lengthValue.IsNumber()
|
|
&& lengthValue.IsNumber()
|
|
&& ((JsNumber) lengthValue)._value >= 0;
|
|
&& ((JsNumber) lengthValue)._value >= 0;
|
|
|
|
|
|
- public virtual uint Length => (uint) TypeConverter.ToLength(Get(KnownKeys.Length));
|
|
|
|
|
|
+
|
|
|
|
+ public virtual uint Length => (uint) TypeConverter.ToLength(Get(CommonProperties.Length));
|
|
|
|
|
|
public virtual JsValue PreventExtensions()
|
|
public virtual JsValue PreventExtensions()
|
|
{
|
|
{
|
|
@@ -1109,20 +1157,20 @@ namespace Jint.Native.Object
|
|
_prototype = value as ObjectInstance;
|
|
_prototype = value as ObjectInstance;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// http://www.ecma-international.org/ecma-262/#sec-createdatapropertyorthrow
|
|
/// http://www.ecma-international.org/ecma-262/#sec-createdatapropertyorthrow
|
|
/// </summary>
|
|
/// </summary>
|
|
- internal bool CreateDataProperty(Key p, JsValue v)
|
|
|
|
|
|
+ internal bool CreateDataProperty(JsValue p, JsValue v)
|
|
{
|
|
{
|
|
var newDesc = new PropertyDescriptor(v, PropertyFlag.ConfigurableEnumerableWritable);
|
|
var newDesc = new PropertyDescriptor(v, PropertyFlag.ConfigurableEnumerableWritable);
|
|
return DefineOwnProperty(p, newDesc);
|
|
return DefineOwnProperty(p, newDesc);
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// http://www.ecma-international.org/ecma-262/#sec-createdataproperty
|
|
/// http://www.ecma-international.org/ecma-262/#sec-createdataproperty
|
|
/// </summary>
|
|
/// </summary>
|
|
- internal bool CreateDataPropertyOrThrow( Key p, JsValue v)
|
|
|
|
|
|
+ internal bool CreateDataPropertyOrThrow(JsValue p, JsValue v)
|
|
{
|
|
{
|
|
if (!CreateDataProperty(p, v))
|
|
if (!CreateDataProperty(p, v))
|
|
{
|
|
{
|
|
@@ -1133,12 +1181,12 @@ namespace Jint.Native.Object
|
|
}
|
|
}
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
- internal ICallable GetMethod(in Key propertyName)
|
|
|
|
|
|
+ internal ICallable GetMethod(JsValue property)
|
|
{
|
|
{
|
|
- return GetMethod(_engine, this, propertyName);
|
|
|
|
|
|
+ return GetMethod(_engine, this, property);
|
|
}
|
|
}
|
|
|
|
|
|
- internal static ICallable GetMethod(Engine engine, JsValue v, in Key p)
|
|
|
|
|
|
+ internal static ICallable GetMethod(Engine engine, JsValue v, JsValue p)
|
|
{
|
|
{
|
|
var jsValue = v.Get(p);
|
|
var jsValue = v.Get(p);
|
|
if (jsValue.IsNullOrUndefined())
|
|
if (jsValue.IsNullOrUndefined())
|
|
@@ -1146,9 +1194,9 @@ namespace Jint.Native.Object
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- return jsValue as ICallable ?? ExceptionHelper.ThrowTypeError<ICallable>(engine, "Value returned for property '" + p.Name + "' of object is not a function");
|
|
|
|
|
|
+ return jsValue as ICallable ?? ExceptionHelper.ThrowTypeError<ICallable>(engine, "Value returned for property '" + p + "' of object is not a function");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
internal ObjectInstance AssertThisIsObjectInstance(JsValue value, string methodName)
|
|
internal ObjectInstance AssertThisIsObjectInstance(JsValue value, string methodName)
|
|
{
|
|
{
|
|
return value as ObjectInstance ?? ThrowIncompatibleReceiver<ObjectInstance>(value, methodName);
|
|
return value as ObjectInstance ?? ThrowIncompatibleReceiver<ObjectInstance>(value, methodName);
|