Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions codegen/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,14 @@ def __call__(self, f: NativeFunction) -> str | None:
if not self.selector.is_root_operator(f"{f.namespace}::{f.func.name}"):
return None

if Variant.function not in f.variants and Variant.method in f.variants:
is_method_variant = True

# only valid remaining case is only function is in f.variants
elif not (Variant.function in f.variants and Variant.method not in f.variants):
if Variant.function not in f.variants and Variant.method not in f.variants:
raise Exception( # noqa: TRY002
f"Can't handle native function {f.func} with the following variant specification {f.variants}."
f"Expected one of function or method to be in variants for {f.func.name}"
)

if Variant.function not in f.variants and Variant.method in f.variants:
is_method_variant = True

sig: CppSignature | ExecutorchCppSignature = (
CppSignatureGroup.from_native_function(
f, method=False, fallback_binding=f.manual_cpp_binding
Expand Down
Loading