Skip to content

Commit 1ae0c7e

Browse files
committed
nits
1 parent e437232 commit 1ae0c7e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/gen_opcodes.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ def fn_num_pushed(self) -> str:
338338

339339
@property
340340
def fn_deopt(self) -> str:
341+
def format_deopt_variants(lst: list[str]) -> str:
342+
return "|".join(f"Self::{v}" for v in lst)
343+
341344
deopts = collections.defaultdict(list)
342345
for inst in self:
343346
deopt = inst.name
@@ -349,9 +352,9 @@ def fn_deopt(self) -> str:
349352
continue
350353
deopts[deopt].append(inst.name)
351354

352-
f = lambda l: "|".join(f"Self::{x}" for x in l)
353355
branches = ",\n".join(
354-
f"{f(deopt)} => Self::{name}" for name, deopt in sorted(deopts.items())
356+
f"{format_deopt_variants(deopt)} => Self::{name}"
357+
for name, deopt in sorted(deopts.items())
355358
)
356359
return f"""
357360
pub const fn deopt(&self) -> Option<Self> {{

0 commit comments

Comments
 (0)