Skip to content

Commit 9ba95c3

Browse files
waskyosipma
authored andcommitted
only defines the roles dictionary once
otherwise mypy gets mad, weird: chb/relational/FunctionRelationalAnalysis.py:450: error: Name 'roles' already defined on line 410
1 parent 9089a79 commit 9ba95c3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

chb/relational/FunctionRelationalAnalysis.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,16 @@ def setup_trampoline_analysis(self, b: str) -> None:
400400
trampoline = cast("ARMCfgTrampolineBlock", self.cfgtc_blocks2[b])
401401
tpre = trampoline.prenodes
402402
tpost = trampoline.postnodes
403+
# Need this definition up here, otherwise mypy gets mad.
404+
roles: Dict[str, "BasicBlock"] = {}
405+
403406
if len(tpre) == 1 and len(tpost) == 1:
404407
if (
405408
tpre[0] in cfg2unmapped
406409
and tpost[0] in cfg2unmapped
407410
and tpre[0] in cfg1unmapped):
408411
# Case where trampoline has an early return and a fallthrough case
409412
# (what we mark as the exit block)
410-
roles: Dict[str, "BasicBlock"] = {}
411413
roles["entry"] = self.basic_blocks2[tpre[0]]
412414
roles["exit"] = self.basic_blocks2[tpost[0]]
413415
for (role, addr) in trampoline.roles.items():
@@ -447,7 +449,6 @@ def setup_trampoline_analysis(self, b: str) -> None:
447449
fallthrough.baddr, fallthrough_post)
448450
return
449451

450-
roles: Dict[str, "BasicBlock"] = {}
451452
roles["entry"] = self.basic_blocks2[tpre[0]]
452453
roles["exit"] = self.basic_blocks2[fallthrough_post[0]]
453454
for (role, addr) in trampoline.roles.items():

0 commit comments

Comments
 (0)