From 2edecdc41a011de00a20fa1f4093701a4989e3d3 Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 18 Mar 2026 13:23:14 +0000 Subject: [PATCH] Add missing type annotations to core CIL classes --- dncil/cil/body/flags.py | 6 +++--- dncil/cil/instruction.py | 4 ++-- dncil/cil/opcode.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dncil/cil/body/flags.py b/dncil/cil/body/flags.py index 7c9b6a0..18ecf53 100644 --- a/dncil/cil/body/flags.py +++ b/dncil/cil/body/flags.py @@ -25,8 +25,8 @@ def __init__(self, flags: int): self.InitLocals: bool = bool(flags & CorILMethod.InitLocals) self.CompressedIL: bool = bool(flags & CorILMethod.CompressedIL) - def __str__(self): - def _to_print(v): + def __str__(self) -> str: + def _to_print(v: bool) -> str: return "true" if v else "false" return ( @@ -39,7 +39,7 @@ def _to_print(v): + f"CompressedIL : {_to_print(self.CompressedIL)}\n" ) - def __repr__(self): + def __repr__(self) -> str: return str(self) def is_tiny(self) -> bool: diff --git a/dncil/cil/instruction.py b/dncil/cil/instruction.py index fcd6b7d..31c7900 100644 --- a/dncil/cil/instruction.py +++ b/dncil/cil/instruction.py @@ -22,7 +22,7 @@ class Instruction: """store managed instruction""" - def __init__(self): + def __init__(self) -> None: self.offset: int self.opcode: OpCode self.opcode_bytes: bytes @@ -45,7 +45,7 @@ def __int__(self) -> int: return self.offset @property - def mnemonic(self): + def mnemonic(self) -> str: """get instruction opcode mnemonic""" return self.opcode.name diff --git a/dncil/cil/opcode.py b/dncil/cil/opcode.py index 900527f..986c4b8 100644 --- a/dncil/cil/opcode.py +++ b/dncil/cil/opcode.py @@ -26,7 +26,7 @@ def __init__( op_code_type: OpCodeType, stack_push: StackBehaviour, stack_pop: StackBehaviour, - ): + ) -> None: self.name: str = name self.value: OpCodeValue = value self.operand_type: OperandType = operand_type