|
@@ -39,16 +39,19 @@ namespace Jint.Native.Object
|
|
|
|
|
|
public virtual IEnumerable<KeyValuePair<string, PropertyDescriptor>> GetOwnProperties()
|
|
|
{
|
|
|
+ EnsureInitialized();
|
|
|
return Properties;
|
|
|
}
|
|
|
|
|
|
public virtual bool HasOwnProperty(string p)
|
|
|
{
|
|
|
+ EnsureInitialized();
|
|
|
return Properties.ContainsKey(p);
|
|
|
}
|
|
|
|
|
|
public virtual void RemoveOwnProperty(string p)
|
|
|
{
|
|
|
+ EnsureInitialized();
|
|
|
Properties.Remove(p);
|
|
|
}
|
|
|
|
|
@@ -95,6 +98,8 @@ namespace Jint.Native.Object
|
|
|
/// <returns></returns>
|
|
|
public virtual PropertyDescriptor GetOwnProperty(string propertyName)
|
|
|
{
|
|
|
+ EnsureInitialized();
|
|
|
+
|
|
|
PropertyDescriptor x;
|
|
|
if (Properties.TryGetValue(propertyName, out x))
|
|
|
{
|
|
@@ -121,6 +126,7 @@ namespace Jint.Native.Object
|
|
|
|
|
|
protected virtual void SetOwnProperty(string propertyName, PropertyDescriptor desc)
|
|
|
{
|
|
|
+ EnsureInitialized();
|
|
|
Properties[propertyName] = desc;
|
|
|
}
|
|
|
|
|
@@ -306,6 +312,8 @@ namespace Jint.Native.Object
|
|
|
/// <returns></returns>
|
|
|
public JsValue DefaultValue(Types hint)
|
|
|
{
|
|
|
+ EnsureInitialized();
|
|
|
+
|
|
|
if (hint == Types.String || (hint == Types.None && Class == "Date"))
|
|
|
{
|
|
|
var toString = Get("toString").TryCast<ICallable>();
|
|
@@ -599,6 +607,11 @@ namespace Jint.Native.Object
|
|
|
SetOwnProperty(name, value);
|
|
|
}
|
|
|
|
|
|
+ protected virtual void EnsureInitialized()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public override string ToString()
|
|
|
{
|
|
|
return TypeConverter.ToString(this);
|