Index: library/nx/nx.tcl =================================================================== diff -u -ra9bbc7c710172e6c24bf1c3a787263f9bcaf3384 -r8be635fcabc150f3922951c71d9919d62db09b10 --- library/nx/nx.tcl (.../nx.tcl) (revision a9bbc7c710172e6c24bf1c3a787263f9bcaf3384) +++ library/nx/nx.tcl (.../nx.tcl) (revision 8be635fcabc150f3922951c71d9919d62db09b10) @@ -1598,7 +1598,7 @@ } ObjectParameterSlot public method definition {} { - set options [:getParameterOptions -withMultiplicity true] + set options [:getParameterOptions -withMultiplicity true -forInfo true] if {[info exists :positional]} {lappend options positional} #if {!${:configurable}} {lappend options noconfig} return [:getPropertyDefinitionOptions [:namedParameterSpec -map-private "" ${:name} $options]] @@ -1958,20 +1958,21 @@ {-withMultiplicity 0} {-withSubstdefault 1} {-forObjectParameter 0} + {-forInfo 0} } { set options "" set slotObject "" if {[info exists :type]} { set type ${:type} - if {$type eq "switch" && !$forObjectParameter} {set type boolean} + if {$type eq "switch" && !$forInfo && !$forObjectParameter} {set type boolean} if {$type in {cmd initcmd}} { lappend options $type } elseif {[string match ::* $type]} { lappend options [expr {[::nsf::is metaclass $type] ? "class" : "object"}] type=$type } else { lappend options $type - if {$type ni [list "" \ + if {!$forInfo && $type ni [list "" \ "boolean" "integer" "object" "class" \ "metaclass" "baseclass" "parameter" \ "alnum" "alpha" "ascii" "control" "digit" "double" \ @@ -2074,7 +2075,7 @@ ::nx::VariableSlot public method parameter {} { # This is a shortened "lightweight" version of "getParameterSpec" # returning less (implicit) details. Used e.g. by "info variable parameter" - set options [:getParameterOptions -withMultiplicity true] + set options [:getParameterOptions -withMultiplicity true -forInfo true] set spec [:namedParameterSpec -map-private "" ${:name} $options] if {[info exists :default]} {lappend spec ${:default}} return $spec Index: tests/info-variable.test =================================================================== diff -u -r8e2e356e9bcef39f43dfe3690b82d9586c7adc72 -r8be635fcabc150f3922951c71d9919d62db09b10 --- tests/info-variable.test (.../info-variable.test) (revision 8e2e356e9bcef39f43dfe3690b82d9586c7adc72) +++ tests/info-variable.test (.../info-variable.test) (revision 8be635fcabc150f3922951c71d9919d62db09b10) @@ -207,6 +207,23 @@ } +nx::test case switch-params { + set cls [nx::Class new { + :property p1:boolean + :property p2:switch + }] + + ? [list lmap p [$cls info variables] "[list $cls info variable parameter] \$p"] \ + "p1:boolean p2:switch" + + ? [list lmap p [$cls info variables] "[list $cls info variable definition] \$p"] \ + [list [list $cls property -accessor none p1:boolean] \ + [list $cls property -accessor none p2:switch]] +} + +# TODO: switch on method parameters + info? +# TODO: switch as sugar for boolean,noarg for nonpos? + nx::test case object-variables { nx::Class create Bar { :property {p 9}