Lambda expression
| 2867 | |
| 2868 | |
| 2869 | class LambdaExpr(FuncItem, Expression): |
| 2870 | """Lambda expression""" |
| 2871 | |
| 2872 | __match_args__ = ("arguments", "arg_names", "arg_kinds", "body") |
| 2873 | |
| 2874 | @property |
| 2875 | def name(self) -> str: |
| 2876 | return LAMBDA_NAME |
| 2877 | |
| 2878 | def expr(self) -> Expression: |
| 2879 | """Return the expression (the body) of the lambda.""" |
| 2880 | ret = self.body.body[-1] |
| 2881 | assert isinstance(ret, ReturnStmt) |
| 2882 | expr = ret.expr |
| 2883 | assert expr is not None # lambda can't have empty body |
| 2884 | return expr |
| 2885 | |
| 2886 | def accept(self, visitor: ExpressionVisitor[T]) -> T: |
| 2887 | return visitor.visit_lambda_expr(self) |
| 2888 | |
| 2889 | def is_dynamic(self) -> bool: |
| 2890 | return False |
| 2891 | |
| 2892 | |
| 2893 | class ListExpr(Expression): |
no outgoing calls
no test coverage detected
searching dependent graphs…