mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-27 11:59:05 +00:00
feat: add real assert
function
This commit is contained in:
parent
d4c566477f
commit
1c6a6b2ec8
2 changed files with 3 additions and 0 deletions
|
@ -1682,6 +1682,7 @@ impl PyCodeGenerator {
|
||||||
ControlKind::While => Identifier::public("while__"),
|
ControlKind::While => Identifier::public("while__"),
|
||||||
ControlKind::With => Identifier::public("with__"),
|
ControlKind::With => Identifier::public("with__"),
|
||||||
ControlKind::Discard => Identifier::public("discard__"),
|
ControlKind::Discard => Identifier::public("discard__"),
|
||||||
|
ControlKind::Assert => Identifier::public("assert__"),
|
||||||
kind => todo!("{kind:?}"),
|
kind => todo!("{kind:?}"),
|
||||||
};
|
};
|
||||||
self.emit_call_local(local, args);
|
self.emit_call_local(local, args);
|
||||||
|
|
|
@ -24,6 +24,8 @@ def with__(obj, body):
|
||||||
def discard__(obj):
|
def discard__(obj):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def assert__(test, msg=None):
|
||||||
|
assert test, msg
|
||||||
|
|
||||||
def then__(x, f):
|
def then__(x, f):
|
||||||
if x == None or x == NotImplemented:
|
if x == None or x == NotImplemented:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue