Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-05-30 01:17:13 +03:00
parent e4372a785c
commit d80aca31fb
2 changed files with 30 additions and 11 deletions

View File

@ -522,8 +522,7 @@ one of the following:
Special case: get callable implementations
```
sources(<object>, '__call__')
sources(<object>, '__call__', <callback>)
sources(<object>, '__call__', ..)
-> <list>
```
@ -563,6 +562,17 @@ callback(<descriptor>, <source>)
-> <value>
```
Special case: get callable implementations
```
values(<object>, '__call__', ..)
-> <list>
```
This will return the callable objects themselves or the value of `.__call__`.
See [`sources(..)`](#sources) for docs on `callback(..)` and special cases.
### `parent(..)`

View File

@ -155,6 +155,12 @@ module.STOP =
// -> list
// -> []
//
// Get callables or objects defining .__call__ (special-case)
// sources(obj, '__call__')
// sources(obj, '__call__', callback)
// -> list
// -> []
//
// callback(obj)
// -> STOP
// -> ..
@ -181,11 +187,6 @@ module.STOP =
// for any overloading in the instance, though this approach is
// not very reusable....
// NOTE: this will not trigger any props...
//
// XXX document the '__call__' special case...
// - '__call__' gets either the callable prototype or .__call__(..)
// - priority...
// -
var sources =
module.sources =
function(obj, name, callback){
@ -229,9 +230,12 @@ function(obj, name, callback){
// -> ..
//
//
// NOTE: for more docs on the callback(..) see sources(..)
// Special case: name is given as '__call__'
// This will return either the value the object if it is callable
// or the value of .__call__ attribute...
//
// XXX document the '__call__' cpecial case...
//
// NOTE: for more docs on the callback(..) see sources(..)
var values =
module.values =
function(obj, name, callback, props){
@ -266,6 +270,11 @@ function(obj, name, callback, props){
// -> value
// -> undefined
//
// Get parent callable or .__call__ value (special-case)
// parent(proto, '__call__')
// -> value
// -> undefined
//
// Get parent method...
// parent(method, this)
// -> meth
@ -633,7 +642,7 @@ function(context, constructor, ...args){
// parent...
Reflect.apply(
constructor.prototype, obj, [this, ...arguments])
// .__call__(..)
// .__call__(..) or fail semi-gracefully...
: constructor.prototype.__call__
.call(obj, this, ...arguments)) },
constructor)