public static bool CallProperty(mdr.DObject input, string propName, out mdr.DValue output) { if (input != null) { var propDesc = input.GetPropertyDescriptor(propName); var prop = new mdr.DValue(); propDesc.Get(input, ref prop); mdr.DFunction func = null; if (prop.ValueType == mdr.ValueTypes.Function) { func = prop.AsDFunction(); //if (toString != null) //{ mdr.CallFrame callFrame = new mdr.CallFrame(); callFrame.This = (input); callFrame.Function = func; func.Call(ref callFrame); if (ValueTypesHelper.IsPrimitive(callFrame.Return.ValueType)) { output = callFrame.Return; return(true); } } } output = new mdr.DValue(); output.SetUndefined(); return(false); }
public static bool Run(mdr.DObject i0, mdr.DFunction i1) { //var prototype = func.GetFieldByFieldIndex(mdr.DType.PrototypeIndex); var prototype = new mdr.DValue(); i1.PrototypePropertyDescriptor.Get(i1, ref prototype); return(i0.Prototype == prototype.AsDObject()); }
public void Set(DObject obj, DFunction value) { Set(obj, (DObject)value); } //To make sure CodeGen can detect this
public virtual void BlackList(DFunction func) { }
public void Set(DFunction v) { Set((DObject)v); }
public static void UpdateCallProfile(CodeGen.Profiler profiler, int profileIndex, DFunction function) { if (profiler != null) profiler.GetOrAddCallNodeProfile(profileIndex).UpdateNodeProfile(function); }