Skip to content

Commit 61d1ce2

Browse files
committed
Log box/unbox
1 parent 5194e16 commit 61d1ce2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

mypyc/transform/log_trace.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from mypyc.ir.func_ir import FuncIR
1313
from mypyc.ir.ops import (
14+
Box,
1415
Call,
1516
CallC,
1617
CString,
@@ -20,6 +21,7 @@
2021
Op,
2122
PrimitiveOp,
2223
SetAttr,
24+
Unbox,
2325
Value,
2426
)
2527
from mypyc.irbuild.ll_builder import LowLevelIRBuilder
@@ -80,7 +82,14 @@ def visit_get_attr(self, op: GetAttr) -> Value | None:
8082
return self.log(op, "get_attr", f"{op.class_type.name}.{op.attr}")
8183

8284
def visit_set_attr(self, op: SetAttr) -> Value | None:
83-
return self.log(op, "set_attr", f"{op.class_type.name}.{op.attr}")
85+
name = "set_attr" if not op.is_init else "set_attr_init"
86+
return self.log(op, name, f"{op.class_type.name}.{op.attr}")
87+
88+
def visit_box(self, op: Box) -> Value | None:
89+
return self.log(op, "box", op.src.type.name)
90+
91+
def visit_unbox(self, op: Unbox) -> Value | None:
92+
return self.log(op, "unbox", op.type.name)
8493

8594
def log(self, op: Op, name: str, details: str) -> Value:
8695
if op.line >= 0:

0 commit comments

Comments
 (0)