feat: add real assert function

This commit is contained in:
Shunsuke Shibayama 2023-04-19 13:23:25 +09:00
parent d4c566477f
commit 1c6a6b2ec8
2 changed files with 3 additions and 0 deletions

View file

@ -1682,6 +1682,7 @@ impl PyCodeGenerator {
ControlKind::While => Identifier::public("while__"),
ControlKind::With => Identifier::public("with__"),
ControlKind::Discard => Identifier::public("discard__"),
ControlKind::Assert => Identifier::public("assert__"),
kind => todo!("{kind:?}"),
};
self.emit_call_local(local, args);

View file

@ -24,6 +24,8 @@ def with__(obj, body):
def discard__(obj):
pass
def assert__(test, msg=None):
assert test, msg
def then__(x, f):
if x == None or x == NotImplemented: