|
| 1 | +// We must wrap the DB types, as these cannot appear in argument lists |
| 2 | +class TypeParameter_ extends @py_type_parameter { |
| 3 | + string toString() { result = "TypeParameter" } |
| 4 | +} |
| 5 | + |
| 6 | +class Expr_ extends @py_expr { |
| 7 | + string toString() { result = "Expr" } |
| 8 | +} |
| 9 | + |
| 10 | +class ExprParent_ extends @py_expr_parent { |
| 11 | + string toString() { result = "ExprParent" } |
| 12 | +} |
| 13 | + |
| 14 | +class TypeVar_ extends @py_TypeVar, TypeParameter_ { |
| 15 | + override string toString() { result = "TypeVar" } |
| 16 | +} |
| 17 | + |
| 18 | +class TypeVarTuple_ extends @py_TypeVarTuple, TypeParameter_ { |
| 19 | + override string toString() { result = "TypeVarTuple" } |
| 20 | +} |
| 21 | + |
| 22 | +class ParamSpec_ extends @py_ParamSpec, TypeParameter_ { |
| 23 | + override string toString() { result = "ParamSpec" } |
| 24 | +} |
| 25 | + |
| 26 | +// From the dbscheme: |
| 27 | +// py_exprs(unique int id : @py_expr, |
| 28 | +// int kind: int ref, |
| 29 | +// int parent : @py_expr_parent ref, |
| 30 | +// int idx : int ref); |
| 31 | +query predicate py_exprs_without_type_parameter_defaults( |
| 32 | + Expr_ id, int kind, ExprParent_ parent, int idx |
| 33 | +) { |
| 34 | + py_exprs(id, kind, parent, idx) and |
| 35 | + // From the dbscheme |
| 36 | + // /* <Field> ParamSpec.default = 2, expr */ |
| 37 | + // /* <Field> TypeVar.default = 3, expr */ |
| 38 | + // /* <Field> TypeVarTuple.default = 2, expr */ |
| 39 | + (parent instanceof ParamSpec_ implies idx != 2) and |
| 40 | + (parent instanceof TypeVar_ implies idx != 3) and |
| 41 | + (parent instanceof TypeVarTuple_ implies idx != 2) |
| 42 | +} |
0 commit comments