From: Sergey Matveev Date: Sat, 28 Jun 2025 09:17:34 +0000 (+0300) Subject: Existence check does not play any role for root element X-Git-Tag: v0.0.0~7 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e1106cb6d1913e8a4d5e21593e14322c1f01fb56d2d1e6d52cb99c0b68fce87c;p=keks.git Existence check does not play any role for root element --- diff --git a/tcl/schema.tcl b/tcl/schema.tcl index db7007d..30d193d 100755 --- a/tcl/schema.tcl +++ b/tcl/schema.tcl @@ -61,6 +61,11 @@ proc field {k types args} { upvar _cmds _cmds buf buf if {$k != "."} { lappend _cmds [TAKE $k] + if {[lsearch -exact $args !exists] != -1} { + lappend _cmds [!EXISTS] + } elseif {[lsearch -exact $args optional] == -1} { + lappend _cmds [EXISTS] + } } if {[lindex $types 0] == "with"} { lappend _cmds [SCHEMA [lindex $types 1]] @@ -77,11 +82,6 @@ proc field {k types args} { lappend _cmds [TYPE {NIL}] lappend _cmds [TAKE $k] } - if {[lsearch -exact $args !exists] != -1} { - lappend _cmds [!EXISTS] - } elseif {[lsearch -exact $args optional] == -1} { - lappend _cmds [EXISTS] - } set i [lsearch -glob $args "len=*"] if {$i != -1} { set n [string range [lindex $args $i] 4 end]