diff --git a/Jurassic/Library/ClrWrapper/ClrInstanceTypeWrapper.cs b/Jurassic/Library/ClrWrapper/ClrInstanceTypeWrapper.cs
index c8262f63..0bc2ebc6 100644
--- a/Jurassic/Library/ClrWrapper/ClrInstanceTypeWrapper.cs
+++ b/Jurassic/Library/ClrWrapper/ClrInstanceTypeWrapper.cs
@@ -113,6 +113,18 @@ public override string DebuggerDisplayType
+ // OBJECTINSTANCE OVERRIDES
+ //_________________________________________________________________________________________
+
+ ///
+ /// This object is a Clr Wrapper
+ ///
+ protected override bool IsClrWrapper
+ {
+ get { return true; }
+ }
+
+
// OBJECT OVERRIDES
//_________________________________________________________________________________________
diff --git a/Jurassic/Library/ClrWrapper/ClrInstanceWrapper.cs b/Jurassic/Library/ClrWrapper/ClrInstanceWrapper.cs
index 822d0497..a98905f5 100644
--- a/Jurassic/Library/ClrWrapper/ClrInstanceWrapper.cs
+++ b/Jurassic/Library/ClrWrapper/ClrInstanceWrapper.cs
@@ -122,6 +122,13 @@ public override string DebuggerDisplayType
// return base.GetPrimitiveValue(typeHint);
//}
+ ///
+ /// This object is a Clr Wrapper
+ ///
+ protected override bool IsClrWrapper
+ {
+ get { return true; }
+ }
diff --git a/Jurassic/Library/ClrWrapper/ClrStaticTypeWrapper.cs b/Jurassic/Library/ClrWrapper/ClrStaticTypeWrapper.cs
index 01e19dcf..a02e5334 100644
--- a/Jurassic/Library/ClrWrapper/ClrStaticTypeWrapper.cs
+++ b/Jurassic/Library/ClrWrapper/ClrStaticTypeWrapper.cs
@@ -199,6 +199,7 @@ internal static void PopulateMembers(ObjectInstance target, Type type, BindingFl
{
// Register static methods as functions.
var methodGroups = new Dictionary>();
+ int indexerCounter = 0;
foreach (var member in type.GetMembers(BindingFlags.Public | BindingFlags.DeclaredOnly | flags))
{
switch (member.MemberType)
@@ -218,7 +219,17 @@ internal static void PopulateMembers(ObjectInstance target, Type type, BindingFl
ClrFunction getter = getMethod == null ? null : new ClrFunction(target.Engine.Function.InstancePrototype, new ClrBinder(getMethod));
var setMethod = property.GetSetMethod();
ClrFunction setter = setMethod == null ? null : new ClrFunction(target.Engine.Function.InstancePrototype, new ClrBinder(setMethod));
- target.DefineProperty(property.Name, new PropertyDescriptor(getter, setter, PropertyAttributes.NonEnumerable), false);
+
+ PropertyAttributes propertyAttributes = PropertyAttributes.NonEnumerable;
+ if (property.GetIndexParameters().Length > 0)
+ {
+ propertyAttributes |= PropertyAttributes.IsIndexProperty;
+ // Put index after name of indexer property to avoid conflict with other properties with same name and other indexers
+ target.DefineProperty(string.Format("{0}{1}", property.Name, indexerCounter++),
+ new PropertyDescriptor(getter, setter, propertyAttributes), false);
+ }
+ else
+ target.DefineProperty(property.Name, new PropertyDescriptor(getter, setter, propertyAttributes), false);
// Property getters and setters also show up as methods, so remove them here.
// NOTE: only works if properties are enumerated after methods.
@@ -254,6 +265,18 @@ internal static void PopulateMembers(ObjectInstance target, Type type, BindingFl
+ // OBJECTINSTANCE OVERRIDES
+ //_________________________________________________________________________________________
+
+ ///
+ /// This object is a Clr Wrapper
+ ///
+ protected override bool IsClrWrapper
+ {
+ get { return true; }
+ }
+
+
// OBJECT OVERRIDES
//_________________________________________________________________________________________
diff --git a/Jurassic/Library/Object/HiddenClassSchema.cs b/Jurassic/Library/Object/HiddenClassSchema.cs
index 9aab1b16..ec34631d 100644
--- a/Jurassic/Library/Object/HiddenClassSchema.cs
+++ b/Jurassic/Library/Object/HiddenClassSchema.cs
@@ -14,7 +14,7 @@ internal class HiddenClassSchema
private Dictionary