Skip to content

Commit d50930a

Browse files
authored
gh-105481: Fix types and a bug for pseudos (#105788)
1 parent 74c2422 commit d50930a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Tools/cases_generator/generate_cases.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ class OverriddenInstructionPlaceHolder:
510510
name: str
511511

512512

513-
AnyInstruction = Instruction | MacroInstruction
513+
AnyInstruction = Instruction | MacroInstruction | PseudoInstruction
514514
INSTR_FMT_PREFIX = "INSTR_FMT_"
515515
INSTR_FLAG_SUFFIX = "_FLAG"
516516

@@ -550,6 +550,7 @@ def error(self, msg: str, node: parser.Node) -> None:
550550
macros: dict[str, parser.Macro]
551551
macro_instrs: dict[str, MacroInstruction]
552552
families: dict[str, parser.Family]
553+
pseudos: dict[str, parser.Pseudo]
553554
pseudo_instrs: dict[str, PseudoInstruction]
554555

555556
def parse(self) -> None:
@@ -607,7 +608,7 @@ def parse_file(self, filename: str, instrs_idx: dict[str, int]) -> None:
607608

608609
# Parse from start
609610
psr.setpos(start)
610-
thing: parser.InstDef | parser.Macro | parser.Family | None
611+
thing: parser.InstDef | parser.Macro | parser.Pseudo | parser.Family | None
611612
thing_first_token = psr.peek()
612613
while thing := psr.definition():
613614
if ws := [w for w in RESERVED_WORDS if variable_used(thing, w)]:
@@ -927,7 +928,7 @@ def effect_str(effects: list[StackEffect]) -> str:
927928
popped = str(-low)
928929
pushed = str(sp - low)
929930
case parser.Pseudo():
930-
instr = self.pseudos[thing.name]
931+
instr = self.pseudo_instrs[thing.name]
931932
popped = pushed = None
932933
# Calculate stack effect, and check that it's the the same
933934
# for all targets.

0 commit comments

Comments
 (0)