Rust: Add Callable as a base class of Function and ClosureExpr

This commit is contained in:
Tom Hvitved
2024-10-11 12:00:30 +02:00
parent 854d7660eb
commit b284a2a7c0
2 changed files with 22 additions and 1 deletions

View File

@@ -1520,3 +1520,21 @@ class _:
todo!()
```
"""
class Callable(AstNode):
"""
A callable. Either a `Function` or a `ClosureExpr`.
"""
param_list: optional["ParamList"] | child
attrs: list["Attr"] | child
@annotate(Function, add_bases=[Callable])
class _:
param_list: drop
attrs: drop
@annotate(ClosureExpr, add_bases=[Callable])
class _:
param_list: drop
attrs: drop