MCPcopy Index your code
hub / github.com/python/mypy / test_get_element_ptr

Method test_get_element_ptr

mypyc/test/test_emitfunc.py:758–773  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

756 )
757
758 def test_get_element_ptr(self) -> None:
759 r = RStruct(
760 "Foo", ["b", "i32", "i64"], [bool_rprimitive, int32_rprimitive, int64_rprimitive]
761 )
762 self.assert_emit(
763 GetElementPtr(self.o, r, "b"),
764 """cpy_r_r0 = (CPyPtr)((CPyPtr)cpy_r_o + offsetof(Foo, b));""",
765 )
766 self.assert_emit(
767 GetElementPtr(self.o, r, "i32"),
768 """cpy_r_r0 = (CPyPtr)((CPyPtr)cpy_r_o + offsetof(Foo, i32));""",
769 )
770 self.assert_emit(
771 GetElementPtr(self.o, r, "i64"),
772 """cpy_r_r0 = (CPyPtr)((CPyPtr)cpy_r_o + offsetof(Foo, i64));""",
773 )
774
775 def test_set_element(self) -> None:
776 # Use compact syntax when setting the initial element of an undefined value

Callers

nothing calls this directly

Calls 3

assert_emitMethod · 0.95
RStructClass · 0.90
GetElementPtrClass · 0.90

Tested by

no test coverage detected