mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
GH-122155: Track local variables between pops and pushes in cases generator (GH-122286)
This commit is contained in:
parent
46f5a4f9e1
commit
a9d56e38a0
13 changed files with 463 additions and 159 deletions
|
@ -216,6 +216,7 @@ Part = Uop | Skip | Flush
|
|||
|
||||
@dataclass
|
||||
class Instruction:
|
||||
where: lexer.Token
|
||||
name: str
|
||||
parts: list[Part]
|
||||
_properties: Properties | None
|
||||
|
@ -690,9 +691,10 @@ def add_op(op: parser.InstDef, uops: dict[str, Uop]) -> None:
|
|||
|
||||
|
||||
def add_instruction(
|
||||
name: str, parts: list[Part], instructions: dict[str, Instruction]
|
||||
where: lexer.Token, name: str, parts: list[Part],
|
||||
instructions: dict[str, Instruction]
|
||||
) -> None:
|
||||
instructions[name] = Instruction(name, parts, None)
|
||||
instructions[name] = Instruction(where, name, parts, None)
|
||||
|
||||
|
||||
def desugar_inst(
|
||||
|
@ -720,7 +722,7 @@ def desugar_inst(
|
|||
parts.append(uop)
|
||||
else:
|
||||
parts[uop_index] = uop
|
||||
add_instruction(name, parts, instructions)
|
||||
add_instruction(inst.first_token, name, parts, instructions)
|
||||
|
||||
|
||||
def add_macro(
|
||||
|
@ -741,7 +743,7 @@ def add_macro(
|
|||
case _:
|
||||
assert False
|
||||
assert parts
|
||||
add_instruction(macro.name, parts, instructions)
|
||||
add_instruction(macro.first_token, macro.name, parts, instructions)
|
||||
|
||||
|
||||
def add_family(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue