public override object callList(List args) { int argsSize = args == null ? 0 : args.sz(); bool isStatic = _isStatic(); int p = checkArgs(argsSize, isStatic, false); object[] a = new object[p]; if (isStatic) { if (args != null && a.Length > 0) { args.toArray(a, 0, a.Length); } return(m.invoke(null, a)); } else { object i = args.get(0); if (a.Length > 0) { args.toArray(a, 1, a.Length); } return(m.invoke(i, a)); } }
public override object callOn(object target, List args) { int argsSize = args == null ? 0 : args.sz(); bool dotnetStatic = _isStatic(); bool fanStatic = ((m.m_flags & (FConst.Static | FConst.Ctor)) != 0); if (dotnetStatic && !fanStatic) { // if Java static doesn't match Fantom static, then this is // a FanXXX method which we need to call as Java static int p = checkArgs(argsSize, false, true); object[] a = new object[p + 1]; a[0] = target; if (args != null && a.Length > 0) { args.copyInto(a, 1, a.Length - 1); } return(m.invoke(null, a)); } else { // we don't include target as part of arguments int p = checkArgs(argsSize, dotnetStatic, true); object[] a = new object[p]; if (args != null && a.Length > 0) { args.toArray(a, 0, a.Length); } return(m.invoke(target, a)); } }
public static void removeHandler(Func func) { lock (lockObj) { List temp = new List(Sys.FuncType, m_handlers); temp.remove(func); m_handlers = (Func[])temp.toArray(new Func[temp.sz()]); } }
public static void addHandler(Func func) { if (!func.isImmutable()) throw NotImmutableErr.make("handler must be immutable").val; lock (lockObj) { List temp = new List(Sys.FuncType, m_handlers).add(func); m_handlers = (Func[])temp.toArray(new Func[temp.sz()]); } }
public static void addHandler(Func func) { if (!func.isImmutable()) { throw NotImmutableErr.make("handler must be immutable").val; } lock (lockObj) { List temp = new List(Sys.FuncType, m_handlers).add(func); m_handlers = (Func[])temp.toArray(new Func[temp.sz()]); } }
public override object callOn(object target, List args) { int argsSize = args == null ? 0 : args.sz(); bool dotnetStatic = _isStatic(); bool fanStatic = ((m.m_flags & (FConst.Static|FConst.Ctor)) != 0); if (dotnetStatic && !fanStatic) { // if Java static doesn't match Fantom static, then this is // a FanXXX method which we need to call as Java static int p = checkArgs(argsSize, false, true); object[] a = new object[p+1]; a[0] = target; if (args != null && a.Length > 0) args.copyInto(a, 1, a.Length-1); return m.invoke(null, a); } else { // we don't include target as part of arguments int p = checkArgs(argsSize, dotnetStatic, true); object[] a = new object[p]; if (args != null && a.Length > 0) args.toArray(a, 0, a.Length); return m.invoke(target, a); } }
public override object callList(List args) { int argsSize = args == null ? 0 : args.sz(); bool isStatic = _isStatic(); int p = checkArgs(argsSize, isStatic, false); object[] a = new object[p]; if (isStatic) { if (args != null && a.Length > 0) args.toArray(a, 0, a.Length); return m.invoke(null, a); } else { object i = args.get(0); if (a.Length > 0) args.toArray(a, 1, a.Length); return m.invoke(i, a); } }