def callmeth(selfbox, argboxes): selfobj = selfbox.getref(SELFTYPE) meth = getattr(selfobj, methname) methargs = getargs(argboxes) res = meth(*methargs) if METH.RESULT is not ootype.Void: return boxresult(METH.RESULT, res)
def getfield(objbox): obj = objbox.getref(TYPE) value = getattr(obj, fieldname) return boxresult(T, value)
def callfunc(funcbox, argboxes): funcobj = funcbox.getref(FUNC) funcargs = getargs(argboxes) res = funcobj(*funcargs) if RESULT is not ootype.Void: return boxresult(RESULT, res)
def getarraylength(arraybox): array = arraybox.getref(ARRAY) return boxresult(ootype.Signed, array.ll_length())
def getarrayitem(arraybox, ibox): array = arraybox.getref(ARRAY) i = ibox.getint() if TYPE is not ootype.Void: return boxresult(TYPE, array.ll_getitem_fast(i))
def create_array(lengthbox): n = lengthbox.getint() return boxresult(ARRAY, ootype.oonewarray(ARRAY, n))
def create(): if isinstance(TYPE, ootype.OOType): return boxresult(TYPE, ootype.new(TYPE)) return None