//ECMA-262 15.2.4.2 void toString(ref mdr.CallFrame callFrame) { DObject obj; if (!ValueTypesHelper.IsDefined(callFrame.This.ValueType)) { obj = Runtime.Instance.GlobalContext; } else { obj = callFrame.This; } //callFrame.Return.Set(obj.ToString()); callFrame.Return.Set(string.Format("[object {0}]", obj.Map.Metadata.Name)); }
//ECMA-262 15.2.4.7 void propertyIsEnumerable(ref mdr.CallFrame callFrame) { DObject obj; if (!ValueTypesHelper.IsDefined(callFrame.This.ValueType)) { obj = Runtime.Instance.GlobalContext; } else { obj = callFrame.This; } //callFrame.Return.Set(obj.ToString()); if (callFrame.PassedArgsCount == 1) { string toString; if (callFrame.Arg0.ValueType == ValueTypes.String) { toString = callFrame.Arg0.AsString(); } else { toString = callFrame.Arg0.AsDObject().GetField("toString").AsString(); } PropertyDescriptor pd = obj.GetPropertyDescriptor(toString); if (pd != null) { callFrame.Return.Set(!pd.IsNotEnumerable); } else { callFrame.Return.Set(false); } } else { callFrame.Return.Set(false); } }