mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-105481: Fix types and a bug for pseudos (#105788)
This commit is contained in:
parent
74c2422fa2
commit
d50930a6a8
1 changed files with 4 additions and 3 deletions
|
@ -510,7 +510,7 @@ class OverriddenInstructionPlaceHolder:
|
||||||
name: str
|
name: str
|
||||||
|
|
||||||
|
|
||||||
AnyInstruction = Instruction | MacroInstruction
|
AnyInstruction = Instruction | MacroInstruction | PseudoInstruction
|
||||||
INSTR_FMT_PREFIX = "INSTR_FMT_"
|
INSTR_FMT_PREFIX = "INSTR_FMT_"
|
||||||
INSTR_FLAG_SUFFIX = "_FLAG"
|
INSTR_FLAG_SUFFIX = "_FLAG"
|
||||||
|
|
||||||
|
@ -550,6 +550,7 @@ class Analyzer:
|
||||||
macros: dict[str, parser.Macro]
|
macros: dict[str, parser.Macro]
|
||||||
macro_instrs: dict[str, MacroInstruction]
|
macro_instrs: dict[str, MacroInstruction]
|
||||||
families: dict[str, parser.Family]
|
families: dict[str, parser.Family]
|
||||||
|
pseudos: dict[str, parser.Pseudo]
|
||||||
pseudo_instrs: dict[str, PseudoInstruction]
|
pseudo_instrs: dict[str, PseudoInstruction]
|
||||||
|
|
||||||
def parse(self) -> None:
|
def parse(self) -> None:
|
||||||
|
@ -607,7 +608,7 @@ class Analyzer:
|
||||||
|
|
||||||
# Parse from start
|
# Parse from start
|
||||||
psr.setpos(start)
|
psr.setpos(start)
|
||||||
thing: parser.InstDef | parser.Macro | parser.Family | None
|
thing: parser.InstDef | parser.Macro | parser.Pseudo | parser.Family | None
|
||||||
thing_first_token = psr.peek()
|
thing_first_token = psr.peek()
|
||||||
while thing := psr.definition():
|
while thing := psr.definition():
|
||||||
if ws := [w for w in RESERVED_WORDS if variable_used(thing, w)]:
|
if ws := [w for w in RESERVED_WORDS if variable_used(thing, w)]:
|
||||||
|
@ -927,7 +928,7 @@ class Analyzer:
|
||||||
popped = str(-low)
|
popped = str(-low)
|
||||||
pushed = str(sp - low)
|
pushed = str(sp - low)
|
||||||
case parser.Pseudo():
|
case parser.Pseudo():
|
||||||
instr = self.pseudos[thing.name]
|
instr = self.pseudo_instrs[thing.name]
|
||||||
popped = pushed = None
|
popped = pushed = None
|
||||||
# Calculate stack effect, and check that it's the the same
|
# Calculate stack effect, and check that it's the the same
|
||||||
# for all targets.
|
# for all targets.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue