(self, node: doc.FunctionDef)
| 406 | self.visit(node) |
| 407 | |
| 408 | def get_dispatch_token(self, node: doc.FunctionDef) -> str: |
| 409 | if not isinstance(node, doc.FunctionDef): |
| 410 | self.report_error(node, "Only can get dispatch token for function.") |
| 411 | if not node.decorator_list: |
| 412 | self.report_error(node, "Function must be decorated") |
| 413 | # TODO: only the last decorator is parsed |
| 414 | decorator = self.eval_expr(node.decorator_list[-1]) |
| 415 | if not hasattr(decorator, "dispatch_token"): |
| 416 | self.report_error(node, "The parser does not understand the decorator") |
| 417 | return decorator.dispatch_token |
| 418 | |
| 419 | def with_dispatch_token(self, token: str): |
| 420 | """Add a new dispatching token as with statement. |
no test coverage detected