reject nulls in match inputs entirely

This commit is contained in:
Daniella / Tove 2024-11-16 00:21:05 +01:00
parent 7e674f0ad7
commit 9e936277c7
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 9 additions and 3 deletions

View file

@ -648,7 +648,10 @@ func times { | with amount callable ;
}
func check-match { bool | with input output ;
output gettype "func" eq input null eq not and if {
input null eq if {
0 2 stop
}
output gettype "func" eq if {
1 2 stop
}
input output eq if {
@ -686,7 +689,10 @@ func match-unchecked { | with input output ;
}
func match { bool | with input output ;
output gettype "func" eq input null eq not and if {
input null eq if {
0 2 stop
}
output gettype "func" eq if {
input output call
1 2 stop
}

View file

@ -138,7 +138,7 @@ fn read_block_dyn(
run_as_base: false,
}))))
}
x if x.len() >= 2 && &x[0..2] == "!{" => {
x if x.len() >= 2 && x.get(0..2) == Some("!{") => {
words.push(Word::Const(Value::Str(x[2..].to_owned())));
}
"<" => {