Information and objects needed to type check attribute access. Look at the docstring of analyze_member_access for more information.
| 81 | |
| 82 | |
| 83 | class MemberContext: |
| 84 | """Information and objects needed to type check attribute access. |
| 85 | |
| 86 | Look at the docstring of analyze_member_access for more information. |
| 87 | """ |
| 88 | |
| 89 | def __init__( |
| 90 | self, |
| 91 | *, |
| 92 | is_lvalue: bool, |
| 93 | is_super: bool, |
| 94 | is_operator: bool, |
| 95 | original_type: Type, |
| 96 | context: Context, |
| 97 | chk: TypeCheckerSharedApi, |
| 98 | self_type: Type | None = None, |
| 99 | module_symbol_table: SymbolTable | None = None, |
| 100 | no_deferral: bool = False, |
| 101 | is_self: bool = False, |
| 102 | rvalue: Expression | None = None, |
| 103 | suppress_errors: bool = False, |
| 104 | preserve_type_var_ids: bool = False, |
| 105 | ) -> None: |
| 106 | self.is_lvalue = is_lvalue |
| 107 | self.is_super = is_super |
| 108 | self.is_operator = is_operator |
| 109 | self.original_type = original_type |
| 110 | self.self_type = self_type or original_type |
| 111 | self.context = context # Error context |
| 112 | self.chk = chk |
| 113 | self.msg = chk.msg |
| 114 | self.module_symbol_table = module_symbol_table |
| 115 | self.no_deferral = no_deferral |
| 116 | self.is_self = is_self |
| 117 | if rvalue is not None: |
| 118 | assert is_lvalue |
| 119 | self.rvalue = rvalue |
| 120 | self.suppress_errors = suppress_errors |
| 121 | # This attribute is only used to preserve old protocol member access logic. |
| 122 | # It is needed to avoid infinite recursion in cases involving self-referential |
| 123 | # generic methods, see find_member() for details. Do not use for other purposes! |
| 124 | self.preserve_type_var_ids = preserve_type_var_ids |
| 125 | |
| 126 | def named_type(self, name: str) -> Instance: |
| 127 | return self.chk.named_type(name) |
| 128 | |
| 129 | def not_ready_callback(self, name: str, context: Context) -> None: |
| 130 | self.chk.handle_cannot_determine_type(name, context) |
| 131 | |
| 132 | def fail(self, msg: str) -> None: |
| 133 | if not self.suppress_errors: |
| 134 | self.msg.fail(msg, self.context) |
| 135 | |
| 136 | def copy_modified( |
| 137 | self, |
| 138 | *, |
| 139 | self_type: Type | None = None, |
| 140 | is_lvalue: bool | None = None, |
no outgoing calls
no test coverage detected
searching dependent graphs…