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

Method error_value_check

mypyc/codegen/emitfunc.py:228–240  ·  view source on GitHub ↗
(self, value: Value, compare: str)

Source from the content-addressed store, hash-verified

226 self.emit_line("goto %s;" % self.label(op.label))
227
228 def error_value_check(self, value: Value, compare: str) -> str:
229 typ = value.type
230 if isinstance(typ, RTuple):
231 # TODO: What about empty tuple?
232 return self.emitter.tuple_undefined_check_cond(
233 typ, self.reg(value), self.c_error_value, compare
234 )
235 elif isinstance(typ, RVec):
236 # Error values for vecs are represented by a negative length.
237 vec_compare = ">=" if compare == "!=" else "<"
238 return f"{self.reg(value)}.len {vec_compare} 0"
239 else:
240 return f"{self.reg(value)} {compare} {self.c_error_value(typ)}"
241
242 def visit_branch(self, op: Branch) -> None:
243 true, false = op.true, op.false

Callers 2

visit_branchMethod · 0.95

Calls 4

regMethod · 0.95
c_error_valueMethod · 0.95
isinstanceFunction · 0.85

Tested by

no test coverage detected