(
self,
typ: RType,
identifier: str,
module_name: str | None = None,
namespace: str = NAMESPACE_STATIC,
line: int = -1,
error_msg: str | None = None,
)
| 1530 | return self.add(LoadLiteral(value, object_rprimitive, line)) |
| 1531 | |
| 1532 | def load_static_checked( |
| 1533 | self, |
| 1534 | typ: RType, |
| 1535 | identifier: str, |
| 1536 | module_name: str | None = None, |
| 1537 | namespace: str = NAMESPACE_STATIC, |
| 1538 | line: int = -1, |
| 1539 | error_msg: str | None = None, |
| 1540 | ) -> Value: |
| 1541 | if error_msg is None: |
| 1542 | error_msg = f'name "{identifier}" is not defined' |
| 1543 | ok_block, error_block = BasicBlock(), BasicBlock() |
| 1544 | value = self.add(LoadStatic(typ, identifier, module_name, namespace, line=line)) |
| 1545 | self.add(Branch(value, error_block, ok_block, Branch.IS_ERROR, rare=True)) |
| 1546 | self.activate_block(error_block) |
| 1547 | self.add(RaiseStandardError(RaiseStandardError.NAME_ERROR, error_msg, line)) |
| 1548 | self.add(Unreachable()) |
| 1549 | self.activate_block(ok_block) |
| 1550 | return value |
| 1551 | |
| 1552 | def load_module(self, name: str) -> Value: |
| 1553 | return self.add(LoadStatic(object_rprimitive, name, namespace=NAMESPACE_MODULE)) |
no test coverage detected