Skip to content

Commit 5d5b7c3

Browse files
committed
Remove commented-out dead code in cases_generator/analyzer.py
Remove the unused analyze_deferred_refs() function that was completely commented out. This function is not referenced anywhere in the codebase and removing it improves code cleanliness. Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
1 parent 42d0140 commit 5d5b7c3

File tree

1 file changed

+0
-57
lines changed

1 file changed

+0
-57
lines changed

Tools/cases_generator/analyzer.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -456,63 +456,6 @@ def error(tkn: lexer.Token) -> None:
456456
return res
457457

458458

459-
#def analyze_deferred_refs(node: parser.InstDef) -> dict[lexer.Token, str | None]:
460-
#"""Look for PyStackRef_FromPyObjectNew() calls"""
461-
462-
#def in_frame_push(idx: int) -> bool:
463-
#for tkn in reversed(node.block.tokens[: idx - 1]):
464-
#if tkn.kind in {"SEMI", "LBRACE", "RBRACE"}:
465-
#return False
466-
#if tkn.kind == "IDENTIFIER" and tkn.text == "_PyFrame_PushUnchecked":
467-
#return True
468-
#return False
469-
470-
#refs: dict[lexer.Token, str | None] = {}
471-
#for idx, tkn in enumerate(node.block.tokens):
472-
#if tkn.kind != "IDENTIFIER" or tkn.text != "PyStackRef_FromPyObjectNew":
473-
#continue
474-
475-
#if idx == 0 or node.block.tokens[idx - 1].kind != "EQUALS":
476-
#if in_frame_push(idx):
477-
## PyStackRef_FromPyObjectNew() is called in _PyFrame_PushUnchecked()
478-
#refs[tkn] = None
479-
#continue
480-
#raise analysis_error("Expected '=' before PyStackRef_FromPyObjectNew", tkn)
481-
482-
#lhs = find_assignment_target(node, idx - 1)
483-
#if len(lhs) == 0:
484-
#raise analysis_error(
485-
#"PyStackRef_FromPyObjectNew() must be assigned to an output", tkn
486-
#)
487-
488-
#if lhs[0].kind == "TIMES" or any(
489-
#t.kind == "ARROW" or t.kind == "LBRACKET" for t in lhs[1:]
490-
#):
491-
## Don't handle: *ptr = ..., ptr->field = ..., or ptr[field] = ...
492-
## Assume that they are visible to the GC.
493-
#refs[tkn] = None
494-
#continue
495-
496-
#if len(lhs) != 1 or lhs[0].kind != "IDENTIFIER":
497-
#raise analysis_error(
498-
#"PyStackRef_FromPyObjectNew() must be assigned to an output", tkn
499-
#)
500-
501-
#name = lhs[0].text
502-
#match = (
503-
#any(var.name == name for var in node.inputs)
504-
#or any(var.name == name for var in node.outputs)
505-
#)
506-
#if not match:
507-
#raise analysis_error(
508-
#f"PyStackRef_FromPyObjectNew() must be assigned to an input or output, not '{name}'",
509-
#tkn,
510-
#)
511-
512-
#refs[tkn] = name
513-
514-
#return refs
515-
516459

517460
def variable_used(node: parser.CodeDef, name: str) -> bool:
518461
"""Determine whether a variable with a given name is used in a node."""

0 commit comments

Comments
 (0)