public static object call(object thisObj, object thisArg, params object [] args) { SemanticAnalyser.assert_type(thisObj, typeof(ScriptFunction)); ScriptFunction fun = (ScriptFunction)thisObj; return(fun.Invoke(thisArg, args)); }
internal string Replace(Match md) { ArrayList arg_list = new ArrayList(); foreach (Group cap in md.Groups) { arg_list.Add(cap.Value); } arg_list.Add(md.Index); arg_list.Add(string_obj); return(Convert.ToString(fun.Invoke(null, arg_list.ToArray()))); }
// Calls a user supplied compare ScriptFunction internal sbyte userCompare(Hashtable elems, bool b1, object o1, uint i2) { bool b2 = !elems.ContainsKey(i2); if (b1 && b2) { return(0); } else if (b1) { return(1); } else if (b2) { return(-1); } object o2 = elems [i2]; if (o1 == null && o2 == null) { return(0); } if (o1 == null) { return(1); } else if (o2 == null) { return(-1); } int res = Convert.ToInt32(cmp.Invoke(null, o1, o2)); if (res < 0) { return(-1); } else if (res > 0) { return(1); } else { return(0); } }
/// <summary> /// Trigger some javascript event on the object /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <param name="eventName"></param> public bool FireEvent(ScriptFunction sf, Event e, object scope) { object result = sf.Invoke(scope, new object[] {e}); //todo: check whether result is NULL? return result is bool ? (bool)result : false; }