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)); } }
/// <summary> /// Constructor used by GenericType and we are given the generic /// method that is being parameterized. /// </summary> public Method(Type parent, string name, int flags, Facets facets, int lineNum, Type returns, Type inheritedReturns, List pars, Method generic) : base(parent, name, flags, facets, lineNum) { List fparams = pars.ro(); if ((flags & (FConst.Static|FConst.Ctor)) == 0) { object[] temp = new object[pars.sz()+1]; temp[0] = new Param("this", parent, 0); pars.copyInto(temp, 1, pars.sz()); fparams = new List(Sys.ParamType, temp); } this.m_func = new MethodFunc(this, returns, fparams); this.m_params = pars; this.m_inheritedReturns = inheritedReturns; this.m_mask = (generic != null) ? 0 : toMask(parent, returns, pars); this.m_generic = generic; }
/// <summary> /// Constructor used by GenericType and we are given the generic /// method that is being parameterized. /// </summary> public Method(Type parent, string name, int flags, Facets facets, int lineNum, Type returns, Type inheritedReturns, List pars, Method generic) : base(parent, name, flags, facets, lineNum) { List fparams = pars.ro(); if ((flags & (FConst.Static | FConst.Ctor)) == 0) { object[] temp = new object[pars.sz() + 1]; temp[0] = new Param("this", parent, 0); pars.copyInto(temp, 1, pars.sz()); fparams = new List(Sys.ParamType, temp); } this.m_func = new MethodFunc(this, returns, fparams); this.m_params = pars; this.m_inheritedReturns = inheritedReturns; this.m_mask = (generic != null) ? 0 : toMask(parent, returns, pars); this.m_generic = generic; }
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); } }