private RuntimeFunction EnsureHomedMethod(EcmaValue value, RuntimeObject target, int requiredLength, string notFunctionError, string incorrectLengthError) { Guard.ArgumentIsCallable(value, notFunctionError); RuntimeFunction fn = value.GetUnderlyingObject <RuntimeFunction>(); if (fn[WellKnownProperty.Length] != requiredLength) { throw new EcmaSyntaxErrorException(incorrectLengthError); } return(fn.AsHomedMethodOf(target)); }