|
16 | 16 | fail, warn, unspecified, unknown, NULL) |
17 | 17 | from libclinic.function import ( |
18 | 18 | Module, Class, Function, Parameter, |
19 | | - FunctionKind, |
| 19 | + FunctionKind, VectorcallOptions, |
20 | 20 | CALLABLE, STATIC_METHOD, CLASS_METHOD, METHOD_INIT, METHOD_NEW, |
21 | 21 | GETTER, SETTER) |
22 | 22 | from libclinic.converter import ( |
@@ -302,8 +302,7 @@ def reset(self) -> None: |
302 | 302 | self.critical_section = False |
303 | 303 | self.target_critical_section = [] |
304 | 304 | self.disable_fastcall = False |
305 | | - self.vectorcall = False |
306 | | - self.vectorcall_exact_only = False |
| 305 | + self.vectorcall: VectorcallOptions | None = None |
307 | 306 | self.permit_long_summary = False |
308 | 307 | self.permit_long_docstring_body = False |
309 | 308 |
|
@@ -469,18 +468,19 @@ def at_staticmethod(self) -> None: |
469 | 468 | self.kind = STATIC_METHOD |
470 | 469 |
|
471 | 470 | def at_vectorcall(self, *args: str) -> None: |
472 | | - if self.vectorcall: |
| 471 | + if self.vectorcall is not None: |
473 | 472 | fail("Called @vectorcall twice!") |
474 | | - self.vectorcall = True |
| 473 | + exact_only = False |
475 | 474 | for arg in args: |
476 | 475 | if '=' in arg: |
477 | 476 | key = arg.split('=', 1)[0] |
478 | 477 | else: |
479 | 478 | key = arg |
480 | 479 | if key == 'exact_only': |
481 | | - self.vectorcall_exact_only = True |
| 480 | + exact_only = True |
482 | 481 | else: |
483 | 482 | fail(f"@vectorcall: unknown argument {key!r}") |
| 483 | + self.vectorcall = VectorcallOptions(exact_only=exact_only) |
484 | 484 |
|
485 | 485 | def at_coexist(self) -> None: |
486 | 486 | if self.coexist: |
@@ -745,7 +745,6 @@ def state_modulename_name(self, line: str) -> None: |
745 | 745 | target_critical_section=self.target_critical_section, |
746 | 746 | forced_text_signature=self.forced_text_signature, |
747 | 747 | vectorcall=self.vectorcall, |
748 | | - vectorcall_exact_only=self.vectorcall_exact_only, |
749 | 748 | ) |
750 | 749 | self.add_function(func) |
751 | 750 |
|
|
0 commit comments