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

Method is_native_attr_ref

mypyc/irbuild/builder.py:1550–1557  ·  view source on GitHub ↗

Is expr a direct reference to a native (struct) attribute of an instance?

(self, expr: MemberExpr)

Source from the content-addressed store, hash-verified

1548 return self.py_get_attr(left, name, line)
1549
1550 def is_native_attr_ref(self, expr: MemberExpr) -> bool:
1551 """Is expr a direct reference to a native (struct) attribute of an instance?"""
1552 obj_rtype = self.node_type(expr.expr)
1553 return (
1554 isinstance(obj_rtype, RInstance)
1555 and obj_rtype.class_ir.is_ext_class
1556 and any(expr.name in ir.attributes for ir in obj_rtype.class_ir.mro)
1557 )
1558
1559 def mark_block_unreachable(self) -> None:
1560 """Mark statements in the innermost block being processed as unreachable.

Callers 3

get_assignment_targetMethod · 0.95
is_borrow_friendly_exprFunction · 0.80
transform_member_exprFunction · 0.80

Calls 3

node_typeMethod · 0.95
isinstanceFunction · 0.85
anyFunction · 0.85

Tested by

no test coverage detected