| 16 | } |
| 17 | |
| 18 | export function ExprMixin<T extends py.Expression, TBase extends BaseCtor<T>>(Base: TBase) { |
| 19 | abstract class Expr extends Base { |
| 20 | override analyze(ctx: AnalysisContext): void { |
| 21 | super.analyze(ctx); |
| 22 | } |
| 23 | |
| 24 | protected attr(...args: DropFirst<Parameters<typeof f.attr>>): ReturnType<typeof f.attr> { |
| 25 | // @ts-expect-error - fix this type |
| 26 | return f.attr(this, ...args); |
| 27 | } |
| 28 | |
| 29 | protected call(...args: DropFirst<Parameters<typeof f.call>>): ReturnType<typeof f.call> { |
| 30 | // @ts-expect-error - fix this type |
| 31 | return f.call(this, ...args); |
| 32 | } |
| 33 | |
| 34 | protected return(): ReturnType<typeof f.return> { |
| 35 | // @ts-expect-error - fix this type |
| 36 | return f.return(this); |
| 37 | } |
| 38 | |
| 39 | protected slice(...args: DropFirst<Parameters<typeof f.slice>>): ReturnType<typeof f.slice> { |
| 40 | return f.slice(this, ...args); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | return Expr as unknown as MixinCtor<TBase, ExprMethods>; |
| 45 | } |