(self, op: LoadLiteral)
| 111 | return self.format("%r = <error> :: %s", op, op.type) |
| 112 | |
| 113 | def visit_load_literal(self, op: LoadLiteral) -> str: |
| 114 | prefix = "" |
| 115 | # For values that have a potential unboxed representation, make |
| 116 | # it explicit that this is a Python object. |
| 117 | if isinstance(op.value, int): |
| 118 | prefix = "object " |
| 119 | |
| 120 | rvalue = repr(op.value) |
| 121 | if isinstance(op.value, frozenset): |
| 122 | # We need to generate a string representation that won't vary |
| 123 | # run-to-run because sets are unordered, otherwise we may get |
| 124 | # spurious irbuild test failures. |
| 125 | # |
| 126 | # Sorting by the item's string representation is a bit of a |
| 127 | # hack, but it's stable and won't cause TypeErrors. |
| 128 | formatted_items = [repr(i) for i in sorted(op.value, key=str)] |
| 129 | rvalue = "frozenset({" + ", ".join(formatted_items) + "})" |
| 130 | return self.format("%r = %s%s", op, prefix, rvalue) |
| 131 | |
| 132 | def visit_get_attr(self, op: GetAttr) -> str: |
| 133 | return self.format("%r = %s%r.%s", op, self.borrow_prefix(op), op.obj, op.attr) |
nothing calls this directly
no test coverage detected