(target, args)
| 21962 | } |
| 21963 | |
| 21964 | invoke(target, args) { |
| 21965 | const builtins = this.builtins; |
| 21966 | if (typeof target === 'string') { |
| 21967 | target = this.resolve(target); |
| 21968 | } |
| 21969 | if (target) { |
| 21970 | if (target.__class__ === builtins.type) { |
| 21971 | if (target.prototype && target.prototype.__class__ === target) { |
| 21972 | return Reflect.construct(target, args); |
| 21973 | } |
| 21974 | const obj = Object.create(target); |
| 21975 | if (obj.__init__ && typeof obj.__init__ === 'function') { |
| 21976 | obj.__init__(...args); |
| 21977 | } |
| 21978 | return obj; |
| 21979 | } else if (target.__class__ === builtins.function) { |
| 21980 | if (target.__call__) { |
| 21981 | return target.__call__(args); |
| 21982 | } |
| 21983 | return target(...args); |
| 21984 | } |
| 21985 | } |
| 21986 | throw new python.Error('Unsupported invoke target.'); |
| 21987 | } |
| 21988 | |
| 21989 | call(target, name, args, keywords, context) { |
| 21990 | const builtins = this.builtins; |
no test coverage detected